tips-computer-incantations

:w !sudo tee % Save a file you edited in vim without the needed permissions

--- cat ~/.ssh/id_rsa.pub

---
ssh user@server "cat >> .ssh/authorized_keys"

in 'screen', to save a copy of the scrollback buffer:

ctrl-a ctrl-+ to get to command mode, then

hardcopy -h <filename>

btw why do i use screen rather than tmux? tmux had problems with using the middle button to paste, over ssh


screen -X -S [session # you want to kill] kill


sudo ln -s /etc/resolvconf/run/resolv.conf


make any website editable

javascript:document.body.contentEditable='true'; document.designMode='on'; void 0


rotate and play a video:

mplayer -vf rotate=2 /tmp/p8253012.avi -vo x11 -ao none -framedrop -nobps -ni -forceidx -mc 0 -vfm ffmpeg -lavdopts fast:skiploopfilter=all

--- strip audio from a video:

ffmpeg -i MVI_0047.AVI -an -vcodec copy /tmp/MVI_0047.AVI


how to increase brightness, hue on videos? the following works but is too big and can't be played on xine

mencoder -o /tmp/test.avi -oac copy -ovc raw -vf eq2=1:1:-0.06:1.20 clouds/090802/p8021536.avi


to test and then deploy djangoappengine projects:

./manage.py runserver ./manage.py deploy


GET http://google.com


When changing email addresses, use mairix, mutt, and a standing emacs session to quickly, semiautomatedly send email to some people who have emailed my old address in the last six months:

put in .mairixrc:


  base=~/Mail
  maildir=...
  mfolder=~/mairixResults
  database=~/Mail/mairix_database

initialize mairix database:

  mairix

create a search folder containing every message sent to my old email address by someone other than myself in the last six months:

  mairix d:6m- t:old_email@inet.org f:~my_own_email@inet.org

(replace old_email@inet.org and my_own_email@inet.org with real addresses)

put in .muttrc:

  macro index <F12> "<reply>^M^Unew email: new_email@inet.org^Mny"

(replace new_email@inet.org with the real address)

also, make sure that your sent mail is being saved in .muttrc, with something like:

  set record= =sent-mail

in emacs, type something like this into any buffer, then kill it (and yank it, if you want):


Hi,

My current email address is now

  new_email@inet.org

You are receiving this automated email because you have recently sent an email to my old email address, old_email@inet.org, which will stop working soon -- please update your address book. Thanks, bayle


restart mutt. change to folder ~/Mail/mairixResults. go down the list until you find someone to whom you'd like to send an update, making sure their message is highlighted. hit F12. this starts a reply to the highlighted message with the subject heading as in the F12 macro definition above. now you land in emacs to type the body of the message. press F3 (begin macro definition). Yank the text of the message. Kill the buffer. You return to mutt, and the mutt macro completes execution by automatically sending the message.

Go down the list until you find someone else you wish to notify. This time, in emacs, just press F4 twice. The first press ends the macro defn, the second press executes the macro (which now includes yanking the text and closing the buffer).

For subsequent notifications, just press F4 (sometimes that didn't work for me and i had to press it twice for some reason).

Be careful not to highlight or copy or kill any text while you're doing this, or emacs might start yanking that into your outgoing message body rather than the text that you want. i'd check your sent-mail after sending the first message to make sure it went out OK (or even send the first one to yourself by sending yourself a test message, highlighting it in Mutt when your receive it, and pressing F12). I'd check sent-mail again when you are done to make sure the rest went out ok.


  1. cp -ax / /l/backup/sda/date sudo rsync -ax / /l/backup/sda/date

---

http://www.google.com/trends/viz?q=mercurial,+git&date=all&geo=all&graph=weekly_img&sort=0&sa=N

links:

http://www.commandlinefu.com/commands/browse/sort-by-votes


ruby debugging

require 'ruby-debug'

debugger

SOME_VARIABLE.public_methods - Object.public_methods


screen -X hardcopy -h /tmp/t