Identi.ca Identi.ca
  • Login
  • Public

    • Public
    • Groups
    • Featured
    • Popular
    • Directory

Ahmed's Tips (aretips)

  1. Ahmed's Tips Ahmed's Tips

    `for i in $(cat file); do whatever $i; done` let's you do an action on each line in a file in #bash

    about 8 months ago from web
  2. Ahmed's Tips Ahmed's Tips

    on linux/osx, when `file` doesn't show image dimensions, you can run `identify foo.jpg` to get the dimensions using #imagemagick

    about 8 months ago from web
  3. Ahmed's Tips Ahmed's Tips

    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

    about 10 months ago from web
  4. Ahmed's Tips Ahmed's Tips

    `curl -u login:pass -F key=value -F key2=value2 http://url` helps in testing POST to webservices from the command line using #curl

    Saturday, 29-May-10 02:33:15 UTC from web
  5. Ahmed's Tips Ahmed's Tips

    `diff -qr dirA dirB` | grep -v -e .git -e .svn | sort` to diff two directories (via http://bit.ly/eerIO)

    Wednesday, 10-Mar-10 08:52:14 UTC from Gwibber
  6. Ahmed's Tips Ahmed's Tips

    `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

    Tuesday, 19-Jan-10 22:36:18 UTC from Gwibber
  7. Ahmed's Tips Ahmed's Tips

    `csplit -k file 20 \{*\}` will split file into as many 20 line parts as possible #csplit

    Tuesday, 19-Jan-10 05:52:42 UTC from Gwibber
  8. Ahmed's Tips Ahmed's Tips

    `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

    Monday, 18-Jan-10 11:15:00 UTC from web
  9. Ahmed's Tips Ahmed's Tips

    `select * from t into outfile 'a.csv' fields terminated by ',' enclosed by '"' lines terminated by '\n'` #mysql to csv - http://ur1.ca/jlka

    Monday, 11-Jan-10 18:06:02 UTC from web
  10. Ahmed's Tips Ahmed's Tips

    `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

    Sunday, 03-Jan-10 17:45:45 UTC from web
  11. Ahmed's Tips Ahmed's Tips

    base conversion using bc - `echo "ibase=16;obase=A;CAFE" | bc` to convert 0xCAFE to base 10. #bc

    Sunday, 03-Jan-10 17:45:02 UTC from web
  12. Ahmed's Tips Ahmed's Tips

    `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

    Sunday, 03-Jan-10 17:44:42 UTC from web
  13. Ahmed's Tips Ahmed's Tips

    coworker pointed out that with a recent coreutils, you can also do `date -d @1207784720` on linux when date -r doesn't exist. #date

    Sunday, 03-Jan-10 17:44:10 UTC from web
  14. Ahmed's Tips Ahmed's Tips

    perl -e 'print scalar localtime 1207784720;' can be used when date -r doesn't exist (ie linux). courtesy of my coworker. #date #perl

    Sunday, 03-Jan-10 17:42:44 UTC from web
  15. Ahmed's Tips Ahmed's Tips

    to empty a file while preserving the actual file and permissions, use `cat /dev/null > filename` #rm

    Friday, 18-Dec-09 16:42:28 UTC from web at Santa Clara, United States
  16. Ahmed's Tips Ahmed's Tips

    `awk '{s+=$1} END {print s}'` sums a list of numbers - really useful. #awk

    Friday, 18-Dec-09 16:39:56 UTC from web
  17. Ahmed's Tips Ahmed's Tips

    `sudo tcpdump -n dst port 80 -c 5 -A -s 0` dump entire packets heading to port 80 (stopping after 5 packets) #tcpdump

    Friday, 18-Dec-09 16:39:39 UTC from web
  18. Ahmed's Tips Ahmed's Tips

    generate histogram data from a data set using `cat file | sort | uniq -c`. add a -g to sort if your data contains numbers. #data

    Friday, 18-Dec-09 16:39:15 UTC from web
  19. Ahmed's Tips Ahmed's Tips

    use `awk '{temp = $1; $1 = $2; $2 = temp; print;}'` to swap two columns of data. #awk

    Friday, 18-Dec-09 16:38:43 UTC from web
  20. Ahmed's Tips Ahmed's Tips

    `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.

    Friday, 18-Dec-09 16:37:56 UTC from web
  • Before

User actions

  • Subscribe
  • List
Ahmed's Tips

Ahmed's Tips

http://whatstheplot.com

tips collected by @ahmedre.

Tags
  • (None)

Site notice

  • API
  • Lockouts explained
  • freelish.us is back

Following 2

  • ahmedre ahmedre
  • Identi.ca microblogging service identica

Followers 2

  • Ahmad Farghal farghal
  • ahmedre ahmedre

Groups 0

    (None)

    Statistics

    User ID
    48793
    Member since
    13 Apr 2009
    Notices
    40
    Daily average
    0

    Feeds

    • Activity Streams
    • RSS 1.0
    • RSS 2.0
    • Atom
    • FOAF
    • Help
    • About
    • FAQ
    • TOS
    • Privacy
    • Source
    • Version
    • Contact

    Identi.ca is a microblogging service brought to you by Status.net. It runs the StatusNet microblogging software, version 1.0.1, available under the GNU Affero General Public License.

    Creative Commons Attribution 3.0 All Identi.ca content and data are available under the Creative Commons Attribution 3.0 license.

    Switch to mobile site layout.

    Built in Montreal