Skip to content

Instantly share code, notes, and snippets.

View johnantoni's full-sized avatar

John Griffiths johnantoni

View GitHub Profile
export PS1='\[\033[0;35m\]\h\[\033[0;33m\] \w\[\033[00m\]: '
alias free="free -m"
alias update="sudo aptitude update"
alias install="sudo aptitude install"
alias upgrade="sudo aptitude safe-upgrade"
alias remove="sudo aptitude remove"
alias clean="sudo aptitude clean"
alias search="sudo aptitude search"
alias brain-update="git clone git://github.com/guillaumegentil/railsbrain-updated.git ~/railsbrain"
alias brain-view="opera ~/railsbrain/index.html"
rails myplaces
cd myplaces
script/plugin install git://github.com/technoweenie/restful-authentication.git
script/generate authenticated user sessions
script/generate scaffold Rental name:string body:text price:integer
make sure you name it right, if you type Rentals instead of Rental you'll be greeted by a fabulous nameerror that'll just want to suck up all your time and reduce your laptop to a smouldering wreck outside the window somewhere.
;-)
##### ruby 1.8
wget ftp://ftp.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz
tar xzf stable*.tar.gz
cd ruby
nano version.h
...change => #define RUBY_PATCHLEVEL -1
...to => #define RUBY_PATCHLEVEL 1
start
xm create /etc/xen/xen01.mybox.com.cfg
start on boot
ln -s /etc/xen/xen03.mybox.com.cfg /etc/xen/auto --force
list running xen machines (dom0 is host)
xm list
who ..users logged in and what they're doing
users ..users logged in
last ..users who have logged in / out + when last rebooted
lastlog ..does the same but lists as log
whoami ..who you're logged in as
sudo passwd [user] ..change users password
nano [file] ..nice text editor
gedit . ..open current dir in gnome editor (note the . )
cat /etc/issue ...return o/s installed
who ..users logged in and what they're doing
users ..users logged in
last ..users who have logged in / out + when last rebooted
lastlog ..does the same but lists as log
whoami ..who you're logged in as
sudo passwd [user] ..change users password
nano [file] ..nice text editor
function killKeys() {
//stop backspace / escape / enter key
if (typeof window.event != 'undefined') // IE
document.onkeydown = function() // IE
{
var t=event.srcElement.type;
var kc=event.keyCode;
//alert('Type: ' + t);
return ((kc != 8 && kc != 13 && kc != 27) || (t == 'text' && kc != 13 && kc != 27) ||
(t == 'textarea' && kc != 27) || (t == 'button' && kc == 13) || (t == 'submit' && kc == 13) ||
function convertUKtoUSdate(ukDate) {
var tmpDate = ukDate;
if (tmpDate.indexOf(" ", 0) > 0) {
tmpDate = tmpDate.slice(0, tmpDate.indexOf(" ", 0) + 1);
}
var sl = tmpDate.length;
s1 = tmpDate.indexOf("/", 0);
var s2 = tmpDate.indexOf("/", s1 + 1);
var useProtocol = "http";
if(location.protocol.toLowerCase() == "https:") useProtocol="https";
else useProtocol = "http";
function addStylesheet(url) {
var stylesheet = document.createElement('link');
stylesheet.rel = 'stylesheet';
stylesheet.type = 'text/css';
stylesheet.href = url;
document.getElementsByTagName('head')[0].appendChild(stylesheet);
}