Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Zeke Sikelianos

« Newer Snippets
Older Snippets »
Showing 11-17 of 17 total

Backup all your del.icio.us bookmarks to XML

   1  
   2  https://api.del.icio.us/v1/posts/all
   3  curl --user accountname:password -o myDelicious.xml -O 'https://api.del.icio.us/v1/posts/all'

Remove all .svn folders from directory recursively

   1  
   2  find . -name .svn -print0 | xargs -0 rm -rf

Paste last-used command with !!

   1  
   2  # Example: Your previous command is ran with sudo in front
   3  sudo !!

Searching tricks with find and grep

   1  
   2  # Find files created between 4*24 and 5*24 hours ago
   3  find ./ -ctime 4

FInd slow actions in a Rails app

   1  
   2  # Show a list of actions sorted by time taken. Useful for finding slow actions.
   3  cat log/development.log | awk '/Completed/ { print "[" $3 "] - " $0 }' | sort -nr

Adding new files to a Subversion Repo

   1  
   2  # List all new files
   3  svn st | grep ? | sed "s/^? //"
   4  
   5  # Add all new files
   6  svn st | grep ? | sed "s/^? //" | xargs svn add
   7  
   8  # Another way to add all new files
   9  svn add * --force

Exclude certain files from an SVN commit

   1  
   2  svn st | grep M | egrep -v routes | awk -F' ' '{ print $2}' | xargs svn ci -m "blah"
   3  
   4  # where egrep -v routes is replaced with all the crap you don't wanna commit
   5  
   6  ie - egrep -v routes | egrep -v this | egrep -v that
   7  
   8  # I can write a script that takes those expressions as command-line options to make it easier if you're interested.. or we can write it together.. we can do it in ruby!
« Newer Snippets
Older Snippets »
Showing 11-17 of 17 total