Saturday, May 1, 2010

Memcached on webfaction

Choose memcached from custom install scripts and set extra info to maximum number of MB (eg 2)

This executes:
memcached start -d -l 127.0.0.1 -m 5 -P $PWD/memcached.pid -p XXXXX

Then can access with gluon.contrib.memcache

Take note of port used

Tuesday, March 16, 2010

Komodo

Run current file with Python: %(python) "%F"

Friday, September 25, 2009

mercurial

.hgrc:
[ui]

username = Richard Baron Penman
verbose = True
merge = internal:merge




Common commands:
hg clone URL # checkout
hg pull # update
hg commit -m "..." # save to local
hg rollback # undo commit
hg push # save to remote

screen

Use ssh to login to server and start screen:
ssh -t $1 'screen -dRR'

screen -S main = create new screen session named "main"
^a d # log out of screen, but leave running
^a c # new window
^a k # close window
^a n # next window
^a p # previous window

Configuration file to paste in ~/.screenrc:
hardstatus on
hardstatus alwayslastline
startup_message off
termcapinfo xterm ti@:te@
hardstatus string "%{= kG}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "
screen -t bash1 1
screen -t bash2 2
screen -t bash3 3
screen -t bash4 4



Good reference

Wednesday, May 20, 2009

Essential Firefox settings

Install these extensions:

Set home page to Google.

Enable master password.

Thursday, October 30, 2008

Regular expressions

email reg exp:
[a-zA-Z0-9._-]+@(([a-zA-Z0-9_-]{2,99}\.)+[a-zA-Z]{2,4})|((25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9]))
url reg exp:
[a-zA-Z]{3,4}[sS]?://((([\w\d\-]+\.)+[ a-zA-Z]{2,4})|((25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])))((\?|/)[\w/=+#_~&:;%\-\?\.]*)
IP reg exp:
(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])

Thursday, October 2, 2008

Automate sudo password

I'm tired of typing my password to add new packages with Synaptic.

So, one solution is to edit the sudoers list with sudo visudo. To automate the sudo password for all programs add:
%yourgroup ALL = NOPASSWD: ALL
But this is excessive, so to automate the password for just a particular program provide its path like this:
%yourgroup ALL = NOPASSWD: /usr/sbin/synaptic

Now I can add new packages with Synaptic without being prompted for a password.