forked from https://github.com/Stratus3D/dotfiles
Stratus3D
Everything I need to get setup on a new machine.
This repository contains my Vim, tmux, Zsh, Bash, and asdf config files, a script to symlink all the config files and directories in place, and a set of setup scripts that install all the tools I need on Ubuntu or OSX.
- Vim, tmux, Zsh, Bash, asdf, and Git configurations
- Setup script that symlinks dotfiles and installs all the software I use
- A collection of Bash scripts I rely on for Erlang development
- List of commands I often forget
curl- For the command below
-
Run the
setup.sh. This will install all the necessary software, setup commonly used directories, and install dotfiles. Since the setup script is idempotent it can be run on machines that have already been setup without causing issues.curl -s https://raw.githubusercontent.com/Stratus3D/dotfiles/master/scripts/setup.sh | bash 2>&1 | tee ~/setup.logOn Debian this is all you need to do. Everything should be installed and configured correctly. On OSX there are two remaining steps.
-
(OSX only) Configure iTerm2 to use the custom profile stored in the dotfiles directory. In the iTerm2 preferences window click the "browse" button and navigate to
~/dotfiles/iterm2_profile/and select the plist file.
This is software that I need for my day-to-day programming work. I try to keep this list updated with the latest software I am using. This allows me to quickly setup new development machines. I am developing a script named checkenv.sh that will verify everything is setup properly.
- Git (https://git-scm.com/)
- Vim (http://www.vim.org/)
- Tmux (https://tmux.github.io/)
- Z shell (http://zsh.sourceforge.net/)
- asdf (https://github.com/asdf-vm/asdf)
- oh-my-zsh (https://github.com/robbyrussell/oh-my-zsh)
- Tmuxinator (https://github.com/tmuxinator/tmuxinator)
- Exuberant Ctags (http://ctags.sourceforge.net/)
- Virtual Box (https://www.virtualbox.org/) & ievms (https://github.com/xdissent/ievms)
- pgAdmin (http://www.pgadmin.org/download/)
- Dash/ZealDocs (http://zealdocs.org/)
OSX Only
- iTerm2 https://iterm2.com/
- Mou http://25.io/mou/
- ipmenulet https://github.com/mcandre/IPMenulet
- ShiftIt https://github.com/fikovnik/ShiftIt
- Firefox
- Chrome
Use asdf for version management (https://github.com/HashNuke/asdf) of each language unless otherwise noted.
- Erlang
- Elixir
- Ruby
- Python
- Lua
- Javascript(NodeJS)
- Go
Offline documentation suitable for day to day use.
- Erlang: http://erldocs.com/
- Elixir: http://elixir-lang.org/docs.html
- Ruby: http://pjkh.com/articles/building-your-own-rails-and-ruby-searchable-api-docs/ and http://shynnergy.com/2012/02/create-local-ruby-on-rails-documentation-for-offline-use/
- JavaScript: https://developer.mozilla.org/media/developer.mozilla.org.tar.gz
- Golang: Run
godoc -http=:6060and then navigate to http://localhost:6060/doc/ - C: http://www.gnu.org/software/libc/manual/html_mono/libc.html
- Make: http://www.gnu.org/software/make/manual/make.html
- Joshua Steele's dotfiles (https://github.com/joshukraine/dotfiles)
- thoughtbot/laptop (https://github.com/thoughtbot/laptop)
- Michael J. Smalley's dotfiles (https://github.com/michaeljsmalley/dotfiles)
- Gary Bernhardt's dotfiles (https://github.com/garybernhardt/dotfiles)
- Andrew Stambrosky's dotfiles (https://github.com/astambrosky/dotfiles)
- Complete the
clone_all_bitbucket_repos.shscript so that all private repos can be cloned. - Complete the
hosts_manager.shscript. - Figure out how to setup docsets locally when running the setup script.
- Make vim highlight HTML and scripts in HTML correctly.
- Add solarized light/dark toggle functions.
- Make vim read color scheme from zsh.
Bash/Zshell Commands
open .to open current directory in Finderopen -a TextEdit textfile.txtto open a file in a specific applicationpython -m SimpleHTTPServer 8000runs a webserver that serves the contents of the directorypython -m smtpd -n -c DebuggingServer localhost:25runs a SMTP server that logs all messages to the console^X, ^Eto edit the currently typed command in vim!!run the last command againcd -change back to the previous directory^Amove to the start of the line^Emove to the end of the line^Bmove back one character^Pscroll backward one item in history^Nscroll forward obackne item in historyEsc-Bmove back one wordEsc-Fmove forward one word^Udelete from cursor to the beginning of the line^Kdelete from the cursor to the end of the line^Ypaste previously deleted command (separate from global Cmd-C buffer). Delete a line with^A ^Kand then paste it back with^Y- Files/directories can be dragged onto the terminal and the path will be pasted at the current cursor position
command <<< "input text"can be used in place ofcommand < file.inpkill <process_name>kills all processes with the given name (e.g.pkill HipChatkills the HipChat app). The-uflag limits the killing to all processes with a certain euid (e.g.pkill -u username HipChat)kill <process_id>kills the process identified by<process_id>.-9can be used to kill the process immediatelyecho -n ✘ | hexdumpto print the encoding of a character by the console. Useful for bash scriptsfor f in directory/* ; do echo -e \\n\\n$f\\n 1>&1 ; cat $f ; done ;print out all file name and file contents for all files indirectory.ssh -vT git@github.comuseful for debugging SSH authentication issues.sudo -u git -H ssh -vT bitbucket.orgsimilar to the SSH command above, only test the connection for a specific user.ssh-addallows identity to be used on remote machines by using the-Aflag with thesshcommand.tar -cvzf tarballname.tar.gz file_or_directorycompressesfile_or_directoryto a tarball namedtarballname.tar.gz.ssh -A -L 5432:localhost:5432 remoteserverto proxy whatever (e.g. PostgreSQL) is listening on port5432onremoteserverto port 5432 onlocalhost.ss -tunaplshow which processes are running on which ports.ss -lntushow which ports have listeners.ls -i -Pshow which processes are running on which ports.iptables -vnLshow default firewall rules.tcpdump -Aprint out all packets.tcpdump -i lo -s0 -w xyz.pcapsave all packets from interface to file.export $(cut -d= -f1 <file>)export all variables in file containing environment variablesfind ./ -type f -exec sed -i -e 's/foo/bar/g' {} \;find and replace string in all files in a directoryfind src -name 'old*' -type f -exec bash -c 'mv "$1" "${1/old/new}"' -- {} \;rename every filename that matches patternsudo getent passwd | cut -d : -f 6 | sudo sed 's:$:/.bash_history:' | sudo xargs -d '\n' grep -H -e "$command"orgrep -e "$pattern" /home/*/.bash_historyto see how others use a commandbindkeyshow Zsh commandscat *.c *.h | cpp -fpreprocessed | sed 's/[_a-zA-Z0-9][_a-zA-Z0-9]*/x/g' | tr -d ' \012' | wc -ccount words in C projectcolumn -t -s ',' data.csvprint CSV as a table in the terminalfile <img file>show general image info like format and dimensionsidentify -verbose <img file>show colorspace, channel depth, dimensions, and other metadata for an imagefor ((n=0;n<10;n++)); do { time bundle exec rspec ./spec ; } 2>> time.txt; donerun a command ten times and write the execution time of each run to a file
OSX Commands
suneeds to besudo su| pasteneeds to be| paste -lsvfsget details on file systemskillall -STOP AppNamepause an appkillall -CONT AppNameresume an app
Vim Commands
vim -u NONEstart vim without any vimrc.vim -u ~/.othervimrcto specify a custom vimrc.vitselect contents of html tag.visual select textin atag.ditwould delete the contents of the tag.^Aand^Xallow you to increment the number your cursor is over, or first number after the cursor that is on the same line.<F4>toggles everything that occupies space to the left of the text (line numbers, gitgutter, etc...)^F-[in tmux works the same as^F <PageUp>, which puts tmux into scroll mode. This command comes in handy on keyboards that don't have<PageUp>and<PageDown>.:21,25s/old/new/gto substitutenewforoldon lines 21 through 25.- When scrolling in tmux,
<fn> <UpArrow>and<fn> <DownArrow>can be used instead of<PageUp>and<PageDown>. This also comes in handy on keyboards that lack Page Up and Page Down. set list!to toggle showing of whitespace characters.g;go back a change positiong,go forward a change positionvim -V9logfiletell Vim to log to file a namedlogfilein the current directory:'<,'>:w !<command>pipe selection to STDIN of<command>. For example, to count the words selected run:'<,'>:w !wc -wor:'<,'>:w !haste|pbcopyto send to pastebin and copy the URL.g^gprint number of selected lines when in visual mode^x^lcomplete whole linecfdo s/foo/bar/g | update- find and replace in all files in quickfix:g/^\d/norm A;- use g + norm to add a semicolon to every line that starts with a number.
SSH/SCP Commands
scp localfile user@remotehost:~to copylocalfileup to your home directory onremotehost.scp user@remotehost:remote/file local/directory/to downloadfilefromremotehost
Make Targets and Commands
print-%: ; @echo $*=$($*)orprint-%: ; @echo '$(subst ','\'',$*=$($*))'allows you to runmake print-<variable_name>and print the value of any variable. Can be used without modifying the file in GNU make 3.82 or greater like this:make --eval="print-%: ; @echo $*=$($*)" print-SOURCE_FILES.
Screen Commands
^A ddetach current window.screen -rdto reattach a window. Follow the prompts if there are multiple windows.
Git Commands
git tag --contains <commit hash>- Lists the tags that include the specified commit.git clean -X- Remove files ignored by Gitgit checkout $(git rev-list -n 1 --before="2016-07-05 21:00" master)- Checkout a branch at a specific point in time.git show $(git rev-list -n 1 --before="2016-07-05 21:00" master):path/to/file- Show what a file looked like at a specific point in time on a specific branch.--ignore-all-space- Ignore whitespace only changes when showing diff.git stash save --keep-index- Stash everything except what is already staged.git add -p- Stage specific changes in a file.git merge-base --is-ancestor <commit-1> <commit-2>- Check ifcommit-1is an ancestor ofcommit-2.git describe --long- version string suitable for Erlang module-vsnattributes.git log --grep="^prefix" --pretty='format:%h - %cn - %s'find all commits withprefixgit log -p --ccshow only resolved conflicts in merge commitsgit shortlog -sn --since='10 weeks' --until='2 weeks'show number commits by each committer between two timesgit diff --word-diffshow changed words rather than linesgit mergetool --tool-helpshow merge tools availablegit checkout -m FILErestores a file to it's unresolved state
Irssi Commands
/server/connect <server name>- Connect to an IRC server (/connect irc.freenode.net)/join <channel name>- Join a channel on an IRC server (/join #erlang)/disconnect/q <users nick>starts a private message with a user./wccloses the current window. This parts from the current channel or disconnects from the current network.Alt + Left Arrow/Right Arrowscroll through Irssi windows.
VirtualBox Commands
VBoxManage unregistervm --delete <vm name>Completely removes the VM and all associated files
Gcc Flags
-ftrapvtrap signed integer overflows
Erlang Flags
bin_opt_infoprint warnings and information about how binaries are used+pc unicodeincrease the range of characters that the system will consider printable. Helpful when testing with unicode in the shell
Bash Flags
-
set -x- Turn on debug mode. -
set -e- Exit if any command has a non-zero exit status. This ensures all commands that can fail are handled properly. -
set -u- Exit if any variable is undefined (other than$* and $ @, which are assumed to be available). -
set -o pipefail- Causes any non-zero exit status in a pipeline to be the exit status of the entire pipeline. http://redsymbol.net/articles/unofficial-bash-strict-mode/
Curl Commands
-w "%{http_code}\n"- Show the status code of the response.
AWK and sed
#!/usr/bin/sed 1d .- prints all but the first line of the sed file.
Postgres
SHOW hba_file;- Show the path topg_hba.confconfig file.\du- Show all roles\x ON- Turn extended display on in the psql console. This prints columns vertically, and is useful for when a table too wide to display in the console.\df+ <function_name>- Show the source code of a Postgres function.
Pranks
say -v whisper "I am watching you"