Skip to content

Instantly share code, notes, and snippets.

@maakuth
maakuth / hetunarvain.py
Last active August 29, 2015 14:05
Henkilötunnuksen arvain.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Näyttää hetuvaihtoehdot syntymän, tarkisteen ja sukupuolen perusteella
import sys
tarkisteet = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','H','J','K','L','M','N','P','R','S','T','U','V','W','X','Y']
if len(sys.argv) < 3:
print ("%s <hetu> <tarkiste> [M|N]" % sys.argv[0])
@maakuth
maakuth / backup.sh
Created August 20, 2013 07:18
Neat way to getting consistent backups of stuff by utilizing LVM snapshots. In my setup /backuptarget is an USB hard drive, but it could be sshfs, smb or nfs share just as well.
#!/bin/sh
. /etc/environment
lvcreate -l90%FREE -s -n rootsnap /dev/host/root
#XFS specific: Mounting ignoring uuid because the original volume has same uuid
mount -o ro,nouuid /dev/host/rootsnap /mnt/rootsnap
mount /backuptarget
@maakuth
maakuth / mendeley-biblatex-dateconversion
Created April 23, 2013 07:11
Sed command to change dd/mm/yy dates to yyyy-mm-dd. I did this to make Mendeley dates work with our faculty LaTeX template (https://yousource.it.jyu.fi/latex-thesis-classes/ttl-gradu).
sed -e "s_\(..\)\/\(..\)\/\(..\)_20\3-\2-\1_"
@maakuth
maakuth / tulosta.sh
Created March 19, 2012 10:12
Printing script for University of Jyväskylä
#!/bin/bash -e
#
# Printing made easy for your Linux laptop in the University of Jyväskylä.
# Public domain. Original work by Zouppen and cedx.
#
# Before using, send your public key to charra (to avoid password prompt)
# and put the following in your ~/.ssh/config:
#
# Host charra
# User YOUR_USERNAME