Skip to content

Instantly share code, notes, and snippets.

View kblum's full-sized avatar

Konrad Blum kblum

View GitHub Profile
@kblum
kblum / magsathome-rename.py
Created September 5, 2018 21:33
Rename PDF magazine issues from MAGatHOME
#!/usr/bin/python
import logging
import argparse
import os
import re
import calendar
def transform_name(fn):
@kblum
kblum / google-earth-dropbox-sync.md
Created October 13, 2016 20:22
Google Earth Dropbox Sync

Google Earth - Dropbox Sync

Synchronise Google Earth places across multiple computers using Dropbox. The instructions are currently specific to OS X but can be extended to Windows and Linux.

Process Description

The ~/Library/Application\ Support/Google\ Earth is moved to a google-earth-sync directory under a Dropbox container directory. A symbolic link is then made to this directory.

The entire Google Earth data directory needs to be synchronised instead of just the myplaces.xml file because of how Google Earth backs the file up. During the backup process after quitting Google Earth, myplaces.kml is renamed to myplaces.backup.kml and then copied to myplaces.kml. If only the myplaces.kml file were to be synchronised with a symbolic link then the synchronisation process would break after one cycle because the backup file would then be the symbolic link.

@kblum
kblum / keybase.md
Created September 7, 2015 19:52
keybase.md

Keybase proof

I hereby claim:

  • I am kblum on github.
  • I am kblum (https://keybase.io/kblum) on keybase.
  • I have a public key whose fingerprint is C1E6 D946 725A 4329 CE66 EBF7 6283 F22F 3B71 1060

To claim this, I am signing this object:

@kblum
kblum / jetbrains_jvm_change.sh
Last active November 23, 2015 12:53 — forked from dannyfallon/rubymine_jdkchange.sh
JetBrains IDE JVM Version Change.
#!/usr/bin/env bash
set -e
if [ -z "$1" ]; then
echo "Must specify app name as argument; exiting"
exit
fi
APP_NAME=`echo "$1" | tr '[:upper:]' '[:lower:]'` # convert to lowercase
@kblum
kblum / ebucks_balance.py
Created September 2, 2012 15:33
Scrape eBucks website and get balance
import urllib, urllib2, cookielib
from BeautifulSoup import BeautifulSoup
import re
def get_ebucks_balance(username, password):
"""Scrape eBucks website to get balance and return as an integer"""
# create opener
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookielib.CookieJar()))
urllib2.install_opener(opener)
@kblum
kblum / gist:1591459
Created January 10, 2012 22:00
Django cache page decorator for class-based view
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
def CachePage(cls=None, **cache_kwargs):
"""
Apply the ``cache_page`` decorator to all the handlers in a class-based
view that delegate to the ``dispatch`` method.
Optional arguments
``timeout`` -- Cache timeout, in seconds.``