Archive for the 'Code' Category
Thursday, October 29th, 2009
This script will run check for ubuntu launch once every 5 mins and let you know if there is an launch.
while [ 1 ]; do if [ -z "`curl -I "http://cdimage.ubuntu.com/releases/9.10/release/"|grep "404"`" ]; then kdialog --msgbox "9.10 Released"; exit; fi; sleep 300; done
Posted in Code, Command Line, Linux | No Comments »
Thursday, June 25th, 2009
Replace one string by another in all file found by find.
find . -name *whatyouwant* -exec perl -pi.bak -e 's/TEXT_TO_REPLACE/TEXT_TO_REPLACE_IT_WITH/g' {} \;
Posted in Command Line, Linux, Perl | No Comments »
Tuesday, June 16th, 2009
Regular expression to link twitter users…
Replace this '@(\w+)'
With this '<a href="http://twitter.com/\1">@\1</a>'
Posted in Code | 3 Comments »
Saturday, June 13th, 2009
Test whether an object is an object or an array
if(Object.prototype.toString.apply(arr) === '[object Array]') alert("Array")
Original Article
Posted in Code, JavaScript | 1 Comment »
Wednesday, May 13th, 2009
A Shell Scirpt to Mount ISO files – call it using the command moustiso.sh ImageFile.iso. You need a folder called /mnt/Image for this to work
#!/bin/sh
sudo mount -o loop "$*" /mnt/Image/
Posted in Code, Linux | 3 Comments »
Monday, May 11th, 2009
Delete leading whitespace (spaces/tabs/etc) from beginning of each line
ruby -pe 'gsub(/^\s+/, "")' < file.txt
Posted in Command Line, Linux, Ruby | 1 Comment »
Thursday, April 30th, 2009
Running Django server on a custom Port
python manage.py runserver 8001
Posted in Code, Command Line, Linux, Python | No Comments »
Tuesday, April 28th, 2009
Install LAMP Stack on Ubuntu/Debian using apt-get
sudo apt-get install openssh-server openssh-client apache2 libapache2-mod-php5 php5-cli php5-common php5-cgi mysql-client mysql-common mysql-server php5-mysql php5-sqlite php5-gd phpmyadmin
Posted in Code, Command Line, Linux | 1 Comment »
Monday, April 27th, 2009
Command to start a new Django project…
django-admin.py startproject [PROJECT_NAME]
cd [PROJECT_NAME]
python manage.py startapp [PROJECT_NAME]
Posted in Code, Command Line, Python | No Comments »
Thursday, April 23rd, 2009
Double space a file with Ruby using the command
ruby -pe 'puts' < file.txt
Posted in Command Line, Linux, Ruby | No Comments »