You might like
`for i in $(cat file); do whatever $i; done` let's you do an action on each line in a file in #bash
on linux/osx, when `file` doesn't show image dimensions, you can run `identify foo.jpg` to get the dimensions using #imagemagick
escape a var in #bash or #zsh with ${i} - ex `for i in 32; do convert foo.jpg -resize ${i}x${i} out.${i}px.jpg; done` - http://ur1.ca/418y7
`curl -u login:pass -F key=value -F key2=value2 http://url` helps in testing POST to webservices from the command line using #curl
`diff -qr dirA dirB` | grep -v -e .git -e .svn | sort` to diff two directories (via http://bit.ly/eerIO)
`curl -O -u login:pass "https://twitter.com/statuses/user_timeline.xml?count=100&page=[1-32]"` backs up #twitter #curl - http://is.gd/6CC3g
`cmd > >(tee out.log) 2> >(tee err.log >&2)` runs cmd and outputs std{out,err} to {out,err}.log, respectively - http://ur1.ca/k3h8 #tee
`select * from t into outfile 'a.csv' fields terminated by ',' enclosed by '"' lines terminated by '\n'` #mysql to csv - http://ur1.ca/jlka
`echo -e "GET / HTTP/1.0\r\nHost: subdomain.domain.com\r\n\r\n" | nc domain.com 80` really helps in testing #webserver config changes! #nc
base conversion using bc - `echo "ibase=16;obase=A;CAFE" | bc` to convert 0xCAFE to base 10. #bc
`i=foo.jpg echo ${i/.jpg}` would remove the .jpg extension from i, thus returning foo. useful for renaming file extensions in a loop. #bash
coworker pointed out that with a recent coreutils, you can also do `date -d @1207784720` on linux when date -r doesn't exist. #date
perl -e 'print scalar localtime 1207784720;' can be used when date -r doesn't exist (ie linux). courtesy of my coworker. #date #perl
to empty a file while preserving the actual file and permissions, use `cat /dev/null > filename` #rm
`sudo tcpdump -n dst port 80 -c 5 -A -s 0` dump entire packets heading to port 80 (stopping after 5 packets) #tcpdump
generate histogram data from a data set using `cat file | sort | uniq -c`. add a -g to sort if your data contains numbers. #data
United States Trends
- 1. #SmackDown N/A
- 2. Olympics N/A
- 3. #TheLastDriveIn N/A
- 4. #OPLive N/A
- 5. #DragRace N/A
- 6. NDSU N/A
- 7. St. John N/A
- 8. #DISASTERSHOW N/A
- 9. UConn N/A
- 10. Obamas N/A
- 11. Malik Monk N/A
- 12. Pistons N/A
- 13. Andrea Bocelli N/A
- 14. Kit Wilson N/A
- 15. Jordynne N/A
- 16. Dylan Cardwell N/A
- 17. Lion King N/A
- 18. Athena N/A
- 19. Hunter Hess N/A
- 20. Scoot Henderson N/A
Something went wrong.
Something went wrong.