2009-12-30

 

Editing the hosts file in Windows 7

Ok - so I haven't used Windows in a while. So I couldn't find the damn hosts file in the new version of Windows...

Well, aparently I'm not the only one and a quick google turned up several helpful sites.

In a nutshell: Click Start – search for “Notepad“, right-click and select “Run as Administrator“. This should launch notepad with elevated privileges. Now, open the host file from the File menu, edit and save. (copied from windowsreference.com)

I still prefer "sudo vim /etc/hosts" :-)

Labels:


2009-12-27

 

Random Speedtest - all is still well in ADSL land !


2009-12-23

 

Python: Convert datetime to unix seconds

A quick solution:
$ python
Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> tt = datetime.datetime( 2009, 12, 23, 6, 0, 0 )
>>> print int( tt.strftime('%s') )
1261540800
>>>
$ date --date="2009-12-23 06:00:00" +%s
1261540800


For a practical implementation, see http://sites.google.com/site/pythonbits/Home/date-and-time-comparison

Labels:


2009-12-09

 

Getting started with screen (quickly)

Screen is a wonderful tool.

I use different configuration files for different scenarios, for example I regularly work on a set of database servers and I like to group them in a config file (for example ~/screen-dbservers).

The top part of the config files contain the following:

hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'


This typically displays a status line on the bottom. It's also in my ~/.screenrc file as the only two lines.

The rest of each individual file contains the servers I connect to (using SSH only in my case):

screen -t db-svr-01 1 ssh db-svr-01
screen -t db-svr-02 2 ssh db-svr-01
screen -t db-svr-03 3 ssh db-svr-01
# etc...


Looking at the first line, it's broken down in the following way:

screen => The screen command
-t db-svr-01 => A label (will be displayed in your status bar)
1 => A number for switching windows (you have 0 through 9)
ssh db-svr-01 => To which server do we SSH


You will notice I tend to keep my labels the same as the host names I'm connecting to - you may obviously prefer something else.

Now, just type:

$ screen -c config-file

 

My fav font for the terminal

Been working on gnome-terminal with the "Inconsolata" font for some time now - really cool!

On Ubuntu, just "sudo apt-get install ttf-inconsolata" and then in gnome-terminal change the default profile (or another profile if you wish) to this font. Mine is set at "Inconsolata Medium 12".

Labels: ,


This page is powered by Blogger. Isn't yours?