Profile_bird

Hey there! aretips is using Twitter.

Twitter is a free service that lets you keep in touch with people through the exchange of quick, frequent answers to one simple question: What are you doing? Join today to start receiving aretips's tweets.

Already using Twitter
from your phone? Click here.

aretips

  1. wget -i equiv using bash and #curl: while read line; do curl -O $line; done < urls
  2. use `/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend` in #osx to lock the screen.
  3. to resize/convert images, use #imagemagick and bash like this: `for i in $( ls *.JPG ); do convert $i -resize 33% new/$i.jpg; done`
  4. in #vim, :set ff=unix to switch a file to unix format, and :set ff=dos to switch it to dos format. [source: lunix.com.au]
  5. in #vim, %s/const char\* \(\w\+\);/const char* \1 = "";/g would replace all "const char* var;" to 'const char* var = "";'
  6. in bash, seq(1) is useful in loops: for i in `seq -f"%03g" 1 114`; do ls $i*; done [source: tldp.org] #seq
  7. `curl -O http://url/[001-114].ext` saves me from writing perl scripts or bash for loops! #curl
  8. after running a command and realizing you need to run it with sudo, just do a 'sudo !!' - courtesy of shell-fu.org. #bash
  9. `find -type d -print0 | xargs -0 -n1 chmod 755` - recursively chmod all directories 'd' as 755. use 'f' instead for files. #find #xargs
  10. use `getconf LONG_BIT` to find out if you're on a 32-bit or 64-bit box #getconf #arch via http://bit.ly/4CO3V2
  11. speaking of #dig, you can use `dig +short txt <keyword>.wp.dg.cx` to query #wikipedia from the command line. source: http://bit.ly/D5gi1
  12. use `dig nameserver -t A domain` to get #dns information about a particular domain, cache expiration time, etc. #dig
  13. in #vim, :.,+2s/foo/bar/g would replace foo with bar in this line and the next two lines.
  14. `20,40 s/bool/int/g` replaces every 'bool' with 'int' between lines 20 and 40 in #vim.
  15. `openssl rand 6 -base64` generates an 8 character password. replace 6 with x to generate a password of length (x*8)/6. #passwords #openssl
  16. to copy a table in mysql, run mysql and do, `create table copy like original`, and then do `insert into copy select * from original` #mysql
  17. `hdiutil makehybrid -udf -udf-volume-name "dvd name" -o out.iso dir/` (where dir contains a VIDEO_TS folder) to make a dvd iso in osx.
  18. when running a bg process remotely via #ssh via script, use `cmd < /dev/null > /dev/null 2>&1 &` to avoid hanging. (see 3.10 in openssh faq)
  19. `cmap w!! %!sudo tee > /dev/null %` in your vimrc let's you write a file as sudo if you forgot to run #vim as sudo [thx stackoverflow].
  20. use `awk '{temp = $1; $1 = $2; $2 = temp; print;}'` to swap two columns of data.