Useful commands:
TODO: rearrange this to bottom = oldest and top = newst (2-27-2020) below dashed line
ln -f -s $(/bin/ls -t tmux_resurrect_*.txt | head -n 1) last
https://help.github.com/articles/changing-author-info/
find . -type f -name '*yml*' -not -path "*node_modules*" -not -path "*bower*" | grep aws
http://stackoverflow.com/questions/1583219/awk-sed-how-to-do-a-recursive-find-replace-of-a-string http://superuser.com/questions/428493/how-can-i-do-a-recursive-find-and-replace-from-the-command-line http://askubuntu.com/questions/266179/how-to-exclude-ignore-hidden-files-and-directories-in-a-wildcard-embedded-find
find . -not -path '*/\.*' -type f -print0 | xargs -0 sed -i 's/thing/another_thing/g'
even better
ag thingy-to-replace -l0 | xargs -0 sed -i '' 's/thingy-to-replace/replacement/g'
also very useful
git diff --name-only HEAD~1 | grep <filename-filter> | xargs sed -i -e 's/thingy-to-replace/replacement/g'
<Return>~.
http://superuser.com/questions/467398/how-do-i-exit-an-ssh-connection/620787#620787
vim -c ":NERDTree"
google vim mouse support
. also http://superuser.com/questions/549930/cant-resize-vim-splits-inside-tmux
http://stackoverflow.com/questions/3249275/vim-multiple-commands-on-same-line
set mouse=a | set ttymouse=xterm2
ag --ignore '*node_mod*' --ignore '*bower*' "thing you actually want"
Ctrl + q
stty -ixon
Ctrl + Z
press it again to make it small again
sudo aptitude -o Acquire::ForceIPv4=true update
the -o Acquire::ForceIPv4=true
works with all of the other commands too
eval `ssh-agent -s`
ssh-add -D
ssh-add ~/.ssh/your_account_key
http://stackoverflow.com/questions/13752908/managing-multiple-ssh-keys-on-heroku http://stackoverflow.com/questions/17846529/could-not-open-a-connection-to-your-authentication-agent
chrome://net-internals/#dns
Ctrl + Delete
kill $(pgrep unity-panel-ser)
sudo -H -u postgres /usr/lib/postgresql/9.3/bin/pg_upgrade \
-b /usr/lib/postgresql/9.2/bin \
-B /usr/lib/postgresql/9.3/bin \
-d /etc/postgresql/9.2/main/ \
-D /etc/postgresql/9.3/main/ \
-p 5432 \
-P 5433
#### then dont forget to go into the new install's postgres.conf and change the port from 5433 to 5432
### also setup trust auth for local dev connections
### this part unmounts the dir for you if it was unproperly done last time. like say by a disconnect
sudo umount -l /path/you/want/stuff/at
sshfs [email protected]:/remote/path/stuff/is/from /path/you/want/stuff/at
SELECT 'ALTER TABLE ' || table_name || ' OWNER TO <new user name>;'
FROM information_schema.tables
WHERE table_schema='public'
AND table_type='BASE TABLE';
http://www.thegeekstuff.com/2010/09/rsync-command-examples/
rsync -avz /root/temp/ [email protected]:/home/thegeekstuff/temp/
vi +124 app/assets/javascripts/application.js.erb
hash.except(*default_hash.keys) != hash.except(default_hash.keys)
http://rubydoc.info/github/rails/arel/master/Arel/Predications
ctags -R app/ test/ vendor/ lib/
or
ctags -R --exclude=vendor --exclude=public --exclude=db .
http://blog.bojica.com/2010/06/27/ctags-and-vim-for-ruby-on-rails-development
select now() - interval '1 year';
http://stackoverflow.com/questions/916875/yank-file-name-path-of-current-buffer-in-vim let @" = expand("%:p")
let @+ = expand("%")
for that awkward moment after you hard reset because you commited a bunch of stuff you didnt want to
git clean -d app/ db/ test/ config/ share/ vendor/ lib/ public/ script/
git log -p
scp ~/path/to/file [email protected]:~/path/on/remote/server
##find sucks use locate, also you can pipe it to grep with the current dir for only that its a seperate db that trails behind the real filesystem but its a shitton faster than find and easier to use
locate file_name_.ext | grep `pwd` | less
locate builder | grep $(pwd)
git submodule init && git submodule foreach git pull origin master
-
make less colorize right
less -R
Re: http://shuttlethread.com/blog/useful-ack-defaults -
http://stackoverflow.com/questions/2928584/how-to-grep-search-the-git-history/2928721#2928721 git log --since=2011.1.1 -S "some string" -- app/helpers/
sudo ipfw add fwd 127.0.0.1,8080 tcp from any to me dst-port 80 in sudo ipfw add fwd 127.0.0.1,8443 tcp from any to me dst-port 443 in
#tmuxinator session rvm use ruby-1.9.3-p0 && mux project_name
#clear the screen with out typing "clear" ^L (ctrl + l)
#find a gem location gem which gem_name
#list ur postgres databases \list
#postgre server log if you install with brew on osx less /usr/local/var/postgres/server.log
#add params / parameters to a rails url url_for(params.merge({:param_name => model.name})
#get a list of vim key mapings :verbose map
#open file in nerdtree with only the context of its parent directory NERDTree %
#find a program path directory location whatnot which ruby
#screw up javascript Array.prototype.push = '(╯°□°)╯︵ ┻━┻';
#git stash only unstaged git stash -k
#git checkout file from branch git co <branch_name> -- <path_to_file>
#catch window.alert errors var oldAlert = window.alert; // reference to the original window.alert
window.alert = function(message) { if (window.console && console.log) { debugger; console.log(message); } else { oldAlert(message); // if console.log doesn't exist call window alert } }
#have git log trace the history of some string in a file git log -S "hi ima string maybe a function_name" app/controllers/some_controller.rb
#history of one file gitx -- path/to/file
#git merge one specific branch with a certain strategy git pull --strategy=ours origin feature/marketer_alerts_ticket_31305
git log | grep Author | sort | uniq | less
Peached Tortilla OR Empanda OR food OR tacos OR truck
"May 17 2011".to_datetime
focus == :foo || focus == :bar AND focus == :foo ||:bar
ARE DIFFERENT THINGS !!!!!!!!!!!!!!!
logger.error "Error: could not do a thing I wanted to do"
logger.error
object.errors
git reset origin/name_of_branch
git log origin/branch..HEAD git log origin/branch..
#pry for the win https://github.com/pry/pry/wiki/Setting-up-Rails-or-Heroku-to-use-Pry binding.pry #this goes in your codes pry -r config/environment
#tell git to ignore changes in tracked files http://pivotallabs.com/users/rolson/blog/articles/1278-ignoring-tracked-files-in-git git update-index --assume-unchanged config/database.yml git update-index --assume-unchanged Gemfile Gemfile.lock
- and to make them survive a hard reset = git update-index --skip-worktree path/to/file = http://fallengamer.livejournal.com/93321.html
./script/generate migration add_to_or_change_database_somehow
class TheMigrationNameAndWhatItDoes < ActiveRecord::Migration def self.up add_column :table_name, :column_name, :type end
def self.down remove_column :table_name, :column_name end end
#git checkout a new branch based off of the current branch git co -b branch_name
#DELETE an address / from the CHROME search BAR suggestion shift + delete
git reset HEAD
http://gitguru.com/2009/02/22/integrating-git-with-a-visual-merge-tool/
#tab between windows of one application superkey + ~
OR bring process back to foreground with: fg
crtl - Z ps aux | grep ruby killall ruby
!WARNING
always use ls -all to/dir
- always use a full path for both source and destination
- in the destination directory to make sure the link was created correctly
ln -s from/dir to/dir
!Important note. if you want it to be directory make sure TO use the slash in from of the source directory
also to double check its correctness
rvm use 1.9.2-p290@gemset_name
http://lostechies.com/derickbailey/2010/04/01/git-how-to-revert-a-branch-merge/ git reset --hard HEAD^
bundle exec thin -e development start
:qa
document.oncontextmenu = null; if (typeof document.body.style.MozUserSelect!="none"){ document.body.style.MozUserSelect=null; } document.body.onmousedown = null;document.body.onselectstart = null;
var element1 = document.createElement("script");element1.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js";element1.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(element1);
rails c test
#Git track a remote branch for an existing branch git branch --set-upstream branch_name origin/branch_name
#Git track a remote branch git branch --track feature/branch_name origin/feature/branch_name
http://guides.macrumors.com/Taking_Screenshots_in_Mac_OS_X
- Command-Shift-4, then select an area: Take a screenshot of an area and save it as a file on the desktop
- Command-Control-Shift-4, then select an area: Take a screenshot of an area and save it to the clipboard
#why you have missing attribute errors http://www.cowboycoded.com/tag/missingattributeerror/
- basically because you used :select
#update test database
bundle exec rake db:migrate && bundle exec rake db:test:prepare
#run tests ruby -I"test" test/functional/controller_name_test.rb --name /account/
#restart windows in safe mode start -> "msconfig" -> boot options
#kill part of the rails cache Rails.cache.clear Rails.cache.delete "key/value/name"
ruby -I test {path/to/test}
http://creechy.wordpress.com/2011/03/16/resizing-an-lvm-in-a-centos-vmware-guest/
/mnt/hgfs
http://lists.centos.org/pipermail/centos-virt/2008-February/000203.html
git fetch --all
git reset --hard origin/<remote-branch-name>
require ".db/migrate/#{timestamp}_migration_name.rb"
WhateverClassName.down
WhateverClassName.up
#pull updates for git submodules git submodule foreach git pull
#Make git not do the thing noted here http://kartzontech.blogspot.com/2011/04/how-to-disable-gnome-ssh-askpass.html unset SSH_ASKPASS
#Make Git shutup completely about ssl certs export GIT_SSL_NO_VERIFY=true
#Make git ignore ssl certs only once env GIT_SSL_NO_VERIFY=true git pull ...
-
tell grep to skip/ignore directory for one command env GREP_OPTIONS="--exclude=*log*" grep -Iirn "pgi=" * | less
-
tell grep to ignore svn directories export GREP_OPTIONS="--exclude=*.svn*"
#switch user super sudo su - postgres
vim line numbers :set number
-
how to search for a file named something in the codebase find . -name 'event.' -type f | less
-
how to search for an instance of something in text of a file in the codebase (-r means recursive, -i is case insensitive, and -l means say the filename instead of printing out the files contents to the standard out)
-
n = include line number
-
I = ignore binary files
grep -Iirn "pgi=" * | less
-
the osx version cuz you know apple always gotta be differnt :/ #http://www.napolitopia.com/2010/03/lscolors-in-osx-snow-leopard-for-dummies/ export LSCOLORS='Bxgxfxfxcxdxdxhbadbxbx'
-
how to highlight directories as a different color from the ls command if that isnt already happening export LS_COLORS='di=01;36'
also^ http://lifehacker.com/219058/geek-to-live--visualize-your-hard-drive-usage du -k | sort -nr
current directory size du -sh (add * for sub dirs)
filesystem size df -h
-
Reload ruby console in ruby console reload!
-
Stop a process then restart when you get ready to use it again in same state
Ctrl + z
fg
git diff . ":^yarn.lock"
install hyperswitch
use Option + Tab