# Used Code

Update Trac wiki from shell

Posted in shell by gregory_vincic on April 8, 2009
if [ "$WIKI_PASSWORD" != "" ]; then
  if  [ -e $WIKI_PAGE ]; then
    WIKI_PAGE=${WIKI_PAGE%%.*}
    cookie=/tmp/cookie
    if [ -e $cookie ]; then rm $cookie; fi
    # Logging on to wiki
      curl -q -c $cookie \
           $WIKI_PROTOCOL://$WIKI_USER:$WIKI_PASSWORD@$WIKI_DOMAIN/$WIKI_LOGIN_PATH
      form_token=`grep form_token $cookie | awk '{ print $7 }'`
      echo -n $form_token > /tmp/token
    # Find latest version of wikipage
      curl -b $cookie -q -o /tmp/wikipage \
          $WIKI_PROTOCOL://$WIKI_DOMAIN/$WIKI_PATH/$WIKI_PAGE?action=edit
      wiki_version=`grep hidden /tmp/wikipage | grep version | awk -F'"' '{print $6}'`
    # Uploading wiki
      curl -q -b $cookie -F "text=<$WIKI_PAGE.wiki" \
                         -F "action=edit" -F "__FORM_TOKEN=</tmp/token" \
                         -F "version=$wiki_version" \
                         $WIKI_PROTOCOL://$WIKI_DOMAIN/$WIKI_PATH/$WIKI_PAGE
    else
      echo "WIKI_PAGE[$WIKI_PAGE] does not exist"
      exit
    fi
else
  echo "WIKI_PASSWORD[$WIKI_PASSWORD] must be specified"
  exit
fi
Tagged with: ,

Open emacs and goto line X

Posted in oneliner by gregory_vincic on March 23, 2009

emacs +LINE[:COLUMN] /path/to/file

Tagged with:

Check disc health

Posted in oneliner by gregory_vincic on March 11, 2009

smartctl -a /dev/sda

Network connections

Posted in oneliner by gregory_vincic on March 9, 2009

netstat -tpe

Remove dotted border in Firefox

Posted in oneliner by gregory_vincic on November 17, 2008

a:focus {outline: none}

Tagged with: , ,

IRC from everywhere

Posted in shell by gregory_vincic on November 17, 2008
screen BitchX irc.freenode.net
Detach with: ctrl-a ctrl-d
Reattach with: screen -d -r

Remove ^M characters

Posted in oneliner by gregory_vincic on November 6, 2008
dos2unix filename

or 

dos2unix file*

See if file contains ^M characters

Posted in oneliner by gregory_vincic on November 6, 2008
cat -e filename

List directories only

Posted in oneliner by gregory_vincic on November 5, 2008
find . -maxdepth 1 -type d -printf "%f\n"
Tagged with: ,

When was the picture taken?

Posted in oneliner by gregory_vincic on November 4, 2008
identify -format "%[EXIF:DateTime]"
Tagged with: , ,
Follow

Get every new post delivered to your Inbox.