you are in: codestackercodes [RSS] → tag: text [RSS]

reverting a file with subversion Delicious

show/hide lines
   1  svn up -r PREV yourfile
created by leozera — 18 November 2008 — get a short url — tags: subversion svn embed

generating a .htpasswd file Delicious

show/hide lines
   1  htpasswd -bc .htpasswd user pass 
created by leozera — 18 November 2008 — get a short url — tags: .htpasswd apache embed

ffmpeg screenshots Delicious

show/hide lines
   1  ffmpeg -itsoffset -4  -i video.mpeg -vframes 1 -an -f mjpeg -s 320x240 video.jpeg
   2  
   3  ffmpeg -i video.flv -vcodec png -ss 00:00:03 -s 320x240 -vframes 1 -an -f rawvideo video.png
created by leozera — 18 November 2008 — get a short url — tags: ffmpeg jpg screenshot embed

remove SVN control Delicious

removes all .svn directories recursively

show/hide lines
   1  find . -name .svn -exec rm -rf {} \; 
   2  
   3  find . -name .svn -print0 | xargs -0 rm -rf
created by leozera — 29 September 2008 — get a short url — tags: shell subversion svn embed

generate short url Delicious

show/hide lines
   1  check this services:
   2  
   3  http://minilink.org/tools.html
   4  http://ln-s.net/home/apidoc.jsp
created by leozera — 16 November 2008 — get a short url — tags: short embed

post in twitter using curl Delicious

show/hide lines
   1  curl -u email:password -d status="hello world!" http://twitter.com/statuses/update.xml 
created by leozera — 16 November 2008 — get a short url — tags: curl twitter embed

bash script to create rails and subversion structure Delicious

show/hide lines
   1  #!/bin/bash
   2  
   3  echo "########################################"
   4  echo ""
   5  echo ""
   6  echo "This bash script creates a new rails project and do the initial svn import with ignoring/deleting files from subversion"
   7  echo ""
   8  echo ""
   9  echo "#######################################"
  10  
  11  echo "Enter svn username: "
  12  read username
  13  echo "Enter the svn url: "
  14  read svn_url
  15  
  16  echo "Enter Rails Application Path:(eg: /home/leonardofaria/Sites/): "
  17  read app_path
  18  echo "Enter Application Name: "
  19  read app_name
  20  
  21  echo "######################################"
  22  echo "Please verify the following variables: "
  23  echo "Svn Username: ${username}"
  24  echo "Svn URL: ${svn_url}"
  25  echo "Application Path: ${app_path}"
  26  echo "Application name: ${app_name}"
  27  
  28  echo "Proceed (y/n)"
  29  read proceed
  30  
  31  if [ ${proceed} = n ] || [ ${proceed} = N ]
  32      then
  33      echo "Terminating..."
  34      exit 0
  35  elif [ ${proceed} = y ] || [ ${proceed} = Y ]
  36      then
  37      app_root="${app_path}/${app_name}"
  38      echo "Generating rails project: (${app_root})"
  39      rails ${app_root}
  40  
  41      echo "SVNinitial import: "
  42      svn import ${app_root} ${svn_url} -m "Initial Import" --username $username
  43  
  44      rm -rf ${app_root}
  45     
  46      echo "Checking out from svn: "
  47  
  48      svn checkout ${svn_url} ${app_root}
  49      cd ${app_root}
  50      echo "Removing all log files from SVN"
  51      svn remove log/*
  52      echo "commiting..."
  53      svn commit -m 'removing all log files from subversion'
  54      echo "Ignoring all log files under log dir"
  55      svn propset svn:ignore "*.log" log/
  56      echo "Updating and commiting..."
  57      svn update log/
  58      svn commit -m 'Ignoring all files in /log/ ending in .log'
  59  
  60      echo "Ignoring cache, sessions, sockets inside tmp dir"
  61      svn propset svn:ignore "*" tmp/sessions tmp/cache tmp/sockets
  62      echo "commiting tmp "
  63      svn commit -m "Ignoring all files in /tmp/"
  64      echo "Updating and commiting again...."
  65  
  66      svn update tmp/
  67      svn commit -m 'Ignore the whole tmp/ directory, might not work on subdirectories?'
  68      echo "Moving database.yml to database.example"
  69      svn move config/database.yml config/database.example
  70      echo "commiting..."
  71      svn commit -m 'Moving database.yml to database.example to provide a template for anyone who checks out the code'
  72      echo "Ignoring database.yml , updating and commiting..."
  73      svn propset svn:ignore "database.yml" config/
  74      svn update config/
  75      svn commit -m 'Ignoring database.yml'
  76      echo "Finished."
  77  
  78  else
  79      echo "Unknown Input. Terminating..."
  80  	exit 0
  81  fi
created by leozera — 15 November 2008 — get a short url — tags: rails subversion embed

time format in ruby Delicious

http://www.ruby-doc.org/core/classes/Time.html#M000236

show/hide lines
   1    %a - The abbreviated weekday name (``Sun'')
   2    %A - The  full  weekday  name (``Sunday'')
   3    %b - The abbreviated month name (``Jan'')
   4    %B - The  full  month  name (``January'')
   5    %c - The preferred local date and time representation
   6    %d - Day of the month (01..31)
   7    %H - Hour of the day, 24-hour clock (00..23)
   8    %I - Hour of the day, 12-hour clock (01..12)
   9    %j - Day of the year (001..366)
  10    %m - Month of the year (01..12)
  11    %M - Minute of the hour (00..59)
  12    %p - Meridian indicator (``AM''  or  ``PM'')
  13    %S - Second of the minute (00..60)
  14    %U - Week  number  of the current year,
  15            starting with the first Sunday as the first
  16            day of the first week (00..53)
  17    %W - Week  number  of the current year,
  18            starting with the first Monday as the first
  19            day of the first week (00..53)
  20    %w - Day of the week (Sunday is 0, 0..6)
  21    %x - Preferred representation for the date alone, no time
  22    %X - Preferred representation for the time alone, no date
  23    %y - Year without a century (00..99)
  24    %Y - Year with century
  25    %Z - Time zone name
  26    %% - Literal ``%'' character
created by leozera — 13 November 2008 — get a short url — tags: ruby time embed

disable spotlight on a fat32 external drive Delicious

show/hide lines
   1  cd /Volumes/your_drive
   2  touch .metadata_never_index
created by leozera — 21 October 2008 — get a short url — tags: mac spotlight terminal embed

alias sample Delicious

the alias command makes it possible to launch any command using a pre-set string. i love it!

show/hide lines
   1  $ alias mypassword="echo '123456'"
   2  
   3  $ mypassword # return '123456'
created by leozera — 17 October 2008 — get a short url — tags: mac terminal embed
Displaying records 1 - 10 of 28