Mikko Kortelainen

Adding Git version control to web sites

Here's a little script I made to make it easy to put a number of existing web sites residing under /var/www under version control by Git. Regarding security, it is obviously not a good idea to initialize the Git repository directly under the site directory, since from there it …

read more

SQLAlchemy Declarative Class Reflector

SQLAlchemy has a nice reflection facility which takes for example a database table name as argument and produces a Table object out of it for manipulation. However, those objects do not behave like the objects produced by declarative classes, which are easier to work with. Here's a little class that …

read more

Editing Tabular Data in Vim

Helpful settings for editing tabular data:

setlocal noexpandtab
setlocal nowrap
setlocal tabstop=16 softtabstop=16 shiftwidth=16

Noexpandtab disables expanding of inputted tabs to spaces. Adjust the number of spaces to your liking. Tabstop sets the visual appearance of tab stops (here 16 spaces).

Show tabs visually, disable cursor line …

read more

How to prefer IPv4 over IPv6 for some hosts

If an IPv6 address is unreachable, but you can reach the IPv4 one, you can set the preference to IPv4 for that particular address by adding a line such as this in /etc/gai.conf:

precedence ::ffff:198.145.11.105/128 100

That will set the preference for host …

PostgreSQL Database Cluster Migration Notes

I had to migrate a pretty big database cluster from one server with PostgreSQL 8.4 to a new server with 9.2 There we multiple apps using the databases, and the downtime had to be minimal. Luckily, the databases were split to multiple schemas, and there were only a …

read more
<< Page 2 of 9 >>