Jojo is resting

Feb 19
2010

Automation of Systems Administration Tasks

Jan 31
2010

No need for complex, unclear, and clumsy programs like Capistrano.

Use Fabric, here is a short exmple, which automates the archive process of users’ directories:

 
# install the Python library
easy_install fabric
 
# create a file called "fabfile"
# it will be used from the "fab" command
# add the following tasks in "fabfile":
from fabric.api import *
 
env.hosts = ["main"]
env.user  = "root"
 
 
def archive_home():
  with cd("/tmp"):
   run("zip -rq home_`date +%Y:%m:%d-%H:%M`.zip /home")
 
def archive_download():
  import os
  os.system("scp %s:/tmp/home_*.zip /home/su/archive" % env.hosts[0])
 
def archive_remove():
  run("rm /tmp/home_*.zip")

In addition you can use decorators to specify different hosts for different tasks.

More about the “fab” command:

fab --help
Usage: fab [options] (command) [:arg1,arg2=val2,host=foo,hosts='h1;h2',...] ...
 
Options:
  -h, --help       show this help message and exit
  -V, --version  show program's version number and exit
  -l, --list           print list of possible commands and exit
  -d COMMAND, --display=COMMAND
                        print detailed info about a given command and exit
  -r, --reject-unknown-hosts
                        reject unknown hosts
  -D, --disable-known-hosts
                        do not load user known_hosts file
  -u USER, --user=USER  username to use when connecting to remote hosts
  -p PASSWORD, --password=PASSWORD
                        password for use with authentication and/or sudo
  -H HOSTS, --hosts=HOSTS
                        comma-separated list of hosts to operate on
  -R ROLES, --roles=ROLES
                        comma-separated list of roles to operate on
  -i KEY_FILENAME       path to SSH private key file. May be repeated.
  -f FABFILE, --fabfile=FABFILE
                        name of fabfile to load, e.g. 'fabfile.py' or
                        '../other.py'
  -w, --warn-only       warn, instead of abort, when commands fail
  -s SHELL, --shell=SHELL
                        specify a new shell, defaults to '/bin/bash -l -c'
  -c RCFILE, --config=RCFILE
                        specify location of config file to use
  --hide=LEVELS           comma-separated list of output levels to hide
  --show=LEVELS         comma-separated list of output levels to show

Smoking Kills

Jan 24
2010

Cigarettes can expose you to a great danger due to a little know behavioural feature.
Imagine the way that each cigarette has – long, boring, lonely. So it’s very natural for a cigarette to become talkative once you free it from the box. And here comes the catch – you begin to socialize with the cigarettes. Which in turn makes you addicted, but even worse – this habit can peril your cosy existence to the point this person has reached:

ssh fails silently on key authentication

Jan 20
2010

If it happens that only root (or no one) can use key authentication, most probably the permissions are wrong. Check the following permissions:

ls -ld ~/.ssh | awk '{print $1}'
# should return drwx------
# otherwise: chmod 0700 ~/.ssh

Educate Yourself

Dec 29
2009

http://educate-yourself.org

socket.error: (99, ‘Cannot assign requested address’)

Dec 27
2009

Enable the localhost interface:
/sbin/ifconfig lo up

Git Cheat Sheet (Debian based)

Dec 17
2009

apt-get remove --purge gitk gitosis git-gui git-core
apt-get install mercurial

`mkdir` and `cd` at once

Dec 16
2009

I am sick of mkdir dir_name; cd dir_name;
The solution (put this function in “.bashrc” or whatever shell config file you use):

_mkcd () {
       mkdir -p $1
       cd $1
}
# usage: _mkcd /tmp/dir_1/dir_2
# pwd will show: /tmp/dir_1/dir_2

Projects’ Hosting

Dec 16
2009

Why Assembla free plan:

  • Subversion Hosting with Integrated Tickets
  • Trac and Subversion Hosting
  • Team Collaboration
  • Subversion Repository
  • Git with Integrated Tickets

P.S. If you are like me - spitting on GIT on a daily basis - Mercurial is included in the other plans.

Christmas names

Dec 15
2009
>>>from nltk.corpus import wordnet as wn
 
>>>wn.synsets('Christmas')[0].lemma_names
 
['Christmas', 'Christmastide', 'Christmastime', 'Yule', 'Yuletide', 'Noel']

Calendar

March 2010
M T W T F S S
« Feb    
1234567
891011121314
15161718192021
22232425262728
293031  

Tags