Friday, 29 July 2011

Tuesday, 26 July 2011

Putty: tango color scheme

You have to create a .reg file and merge it into the registry. The content of the reg file should be:

[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\aldebaran]
"Colour0"="238,238,236"
"Colour1"="255,255,255"
"Colour2"="47,47,47"
"Colour3"="46,52,54"
"Colour4"="0,0,0"
"Colour5"="0,255,0"
"Colour6"="0,0,0"
"Colour7"="46,52,54"
"Colour8"="164,0,0"
"Colour9"="204,0,0"
"Colour10"="78,154,6"
"Colour11"="115,210,22"
"Colour12"="237,212,0"
"Colour13"="252,233,79"
"Colour14"="32,74,135"
"Colour15"="52,101,164"
"Colour16"="117,80,123"
"Colour17"="173,127,168"
"Colour18"="245,121,0"
"Colour19"="252,175,62"
"Colour20"="238,238,236"
"Colour21"="255,255,255"
 The aldebaran at the end is the saved putty session config's name. Note that this registry route will only work fine on the installed version, not on a "portable version". You should manually search for your setting by name on portable versions as it could look something by this:
[HKEY_USERS\S-1-5-21-4174247993-4083704086-623223898-1000\Software\SimonTatham\PuTTY\Sessions\orc]
You can export your putty keys with this command line string:
regedit /ea new.reg HKEY_CURRENT_USER\Software\SimonTatham\PuTTY

UPDATE:

 The new 0.62 version has a bit different place in the registry. The key is to search through  the registry for the string "SimonTatham" and it's sub tree content should contain your already saved profiles. Then all I did is export one of my profiles branch, edit that .reg file and merge it back. Profit.

Sunday, 24 July 2011

Linux: mount a Windows share with CIFS

When you are a web developer and developing a software run on a Linux platform you might end up running your dev pc with Windows with a Linux virtual machine client. Then comes the question: how to share the source code transparently with the virtual machine and the host?
Here's a possible setup:
Windows 7 host, Ubuntu server in a VMware Player. On the host I share (with the simple Windows share, Samba if you like) my web development directory with all of the sources I would like the Linux server to use as well. Then I mount that share on through a bridged or host-only network interface on the Linux server with the following two choices:

1. Modify /etc/fstab. Add the following line:
//192.168.x.x/hostdir /opt/clientdir cifs username=hostuser,password=hostuserpass,uid=1000,gid=1000,file_mode=0666,dir_mode=0777,noserverino,rw,iocharset=utf8 0 0
2. If you do not have the share served all the time or in some cases it is dynamically available then use this shell script instead to mount it:
#!/bin/sh
mount -t cifs //192.168.x.x/hostdir /opt/clientdir -o username=hostuser,password=hostuserpass,uid=1000,gid=1000,file_mode=0666,dir_mode=0777,noserverino,rw,iocharset=utf8



Saturday, 23 July 2011

Python: gmail unread E-mail checker

Python: move files to creation date named directories

Some years earlier I needed to have a little script to sort out tons of photos imported from my camera. The criteria was to put every photo into it's own directory by creation date. First I made this script in 2.6 but lately updated to 3.x.


World of Warcraft: disable the red error text

If you don't want any error messages at all (without an addon) use these commands:
/run SLASH_UI_ERRORS_OFF1 = "/erroff"
/erroff
This will disable the red text and the error sounds and speech.

If you want to selectively disable errors, define /erroff and /erron somewhere:
/run SLASH_UI_ERRORS_OFF1 = "/erroff"
/run SLASH_UI_ERRORS_ON1 = "/erron"
then make macros for the abilities you want to spam like this:
#showtooltip
/erroff
/cast SomeSpell
/erron

Javascript: execute function by name


jQuery carousel


jQueryfier bookmarklet

This bookmarklet adds the latest jQuery to the current page if no jQuery exists yet. If jQuery would conflict with other library then it will tell you what caller to use.

jQueryfy this page

Google Bookmark bookmarker bookmarklet ^_^

If you are logged in to your Google account and familiar with Google Bookmarks, then here is a bookmarklet for you:

Bookmark this

How to use: Drag the above link onto your bookmark toolbar. When you are on a page that you would like to bookmark in Google Bookmarks, push the bookmark. That's all.

Firefox 3 about:config settings

These settings are my favourite ones:
  • browser.cache.disk.enable = false //I have enough memory
  • browser.cache.memory.enable = true
  • browser.cache.memory.capacity = 10240 //256MB //I wish to limit the memory consumption
  • browser.cache.disk.parent_directory = /tmp //when I use tmpfs on Linux for the /tmp directory
  • browser.download.manager.scanWhenDone = false //I do not use an antivirus software
  • network.http.keep-alive = false
  • network.http.proxy.keep-alive = false
  • network.http.max-connections = 64
  • network.http.max-connections-per-server =32
  • network.http.max-persistent-connections-per-proxy =16
  • network.http.max-persistent-connections-per-server = 12
  • network.http.pipelining = true
  • network.http.pipelining.maxrequests = 8
  • network.http.proxy.pipelining = true
  • network.http.request.max-start-delay = 0
  • content.notify.interval = 500000
  • content.notify.ontimer = True
  • content.switch.threshold = 250000
  • browser.sessionhistory.max_total_viewers = 3
  • browser.sessionstore.interval = 60000

Regular expression: IPv6

/^([a-fA-F0-9]{1,4}):([a-fA-F0-9]{1,4}):([a-fA-F0-9]{1,4}):([a-fA-F0-9]{1,4}):([a-fA-F0-9]{1,4}):([a-fA-F0-9]{1,4}):([a-fA-F0-9]{1,4}):([a-fA-F0-9]{1,4})$/

Regular expression: color hex code

It will match the short 3 digit form for the 216 Web safe colors and the full 6 digit form too.

^#?([a-f]|[A-F]|[0-9]){3}(([a-f]|[A-F]|[0-9]){3})?$