GithubHelp home page GithubHelp logo

jjdltorre / mynotes Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 27.55 MB

sed

Vim Script 7.04% Shell 1.33% Java 0.18% Python 62.43% CMake 1.29% C++ 4.49% Dockerfile 2.11% JavaScript 13.62% HTML 4.87% CSS 2.63%

mynotes's Introduction

MyNotes

Command Line Union, Intersection, and Difference

Files:

Juan@Juan-XPS-2011 ~/tmp
$ cat File1.txt
A
B
C
Juan@Juan-XPS-2011 ~/tmp
$ cat File2.txt
A
D
F

Union: sort -u files...

Juan@Juan-XPS-2011 ~/tmp
$ sort -u File1.txt File2.txt
A
B
C
D
F

Intersection: sort files... | uniq -d

Juan@Juan-XPS-2011 ~/tmp
$ sort File1.txt File2.txt | uniq -d
A

Difference: sort files... | uniq -u

Juan@Juan-XPS-2011 ~/tmp
$ sort File1.txt File2.txt | uniq -u
B
C
D
F

Tee to a log file

$ command | tee -a logs/`date +%Y-%m-%d_%H-%M-%S`_command.log

Vagrant

Adding personal ssh public key and current user

Vagrantfile

  config.vm.provision "shell" do |s|

    ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip 
    s.inline = <<-SHELL
      sed -ie 's/^.*: history-search-backward/\"\\e[A\": history-search-backward/' /etc/inputrc
      sed -ie 's/^.*: history-search-forward/\"\\e[B\": history-search-forward/' /etc/inputrc

      echo #{ssh_pub_key} >> /home/vagrant/.ssh/authorized_keys

      useradd #{ENV['USER']}

      echo "%"#{ENV['USER']} " ALL=(ALL) ALL" > /etc/sudoers.d/#{ENV['USER']}

      mkdir -p /home/#{ENV['USER']}/.ssh/
      echo #{ssh_pub_key} >> /home/#{ENV['USER']}/.ssh/authorized_keys
      chown --recursive #{ENV['USER']}:#{ENV['USER']} /home/#{ENV['USER']}/.ssh
      chmod 700 /home/#{ENV['USER']}/.ssh/
      chmod 600 /home/#{ENV['USER']}/.ssh/authorized_keys
    SHELL
  end

mynotes's People

Contributors

jjdltorre avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.