Skip to content

Instantly share code, notes, and snippets.


Jonas Kalderstam spacecowboy

View GitHub Profile
spacecowboy / cartesianProduct.kt
Last active May 13, 2020
Calculates the cartesian product of an arbitrary number of lists
View cartesianProduct.kt
Calculates the cartesian product of an arbitrary number of lists.
Given `[[1, 2, 3], ["a", "b"]]`, it will produce
[1, "a"],
[2, "a"],
[3, "a"],
spacecowboy /
Created Feb 23, 2017
Naive OPML to Orgmode converter
#!/usr/bin/env perl
print "* Blogs\n";
while (<>) {
if (/text="(.*?)">/) {
print "** $1 :$1:\n";
if (/text="(.*?)" type=".*?" xmlUrl="(.*?)"/) {
print "*** [[$2][$1]]\n"
spacecowboy /
Created Feb 8, 2017
Script which outputs a key list with 'X'-es on the keys you've verified.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
Usage: {} <ksp-fosdem.txt> <result.txt>
Marks which keys you have verified from a keysigning party.
Tested on FOSDEM keysigning party 2017.

Keybase proof

I hereby claim:

  • I am spacecowboy on github.
  • I am spacecowboy ( on keybase.
  • I have a public key whose fingerprint is 3270 DC43 5A7D 604F 5B06 3521 987C 54AB 0D44 51ED

To claim this, I am signing this object:

spacecowboy /
Last active Jul 17, 2016
Python script to migrate a Ghost blog to Hugo, including tags and banner images
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
A simple program which migrates an exported Ghost blog to Hugo.
It assumes your blog is using the hugo-icarus theme, but should
work for any theme. The script will migrate your posts, including
tags and banner images. Furthermore, it will make sure that
all your old post urls will keep working by adding aliases to them.
The only thing you need to do yourself is copying the `images/`
spacecowboy /
Created Aug 25, 2015
Download hphosts file and convert it to squidGuard formatting.
# Move to temporary directory
mkdir -p $TEMPDIR
rm -rf $TEMPDIR/*
View build-all-wheels.bat
:: Required: git, Visual Studio 10.0 Express, Visual Studio 9 Express,
:: Windows 7 SDK (.NET 4), Windows 7 SDK (.NET 3.5), Anaconda/Miniconda
:: User configurable stuff start ::
:: These depends on where you installed Anaconda.
:: Python2 or Python3 doesn't matter but you need both 32bit and 64bit versions.
View matplotlibrc
# This is a sample matplotlib configuration file - you can find a copy
# of it on your system in
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it
# there, please note that it will be overridden in your next install.
# If you want to keep a permanent local copy that will not be
# over-written, place it in HOME/.matplotlib/matplotlibrc (unix/linux
# like systems) and C:\Documents and Settings\yourname\.matplotlib
# (win32 systems).
spacecowboy /
Created Sep 8, 2011
A simple proof of concept for building your own super computer in python, assuming you have access to many machines.
from multiprocessing.managers import BaseManager
from mathenate import mathenate
#Define manager
class QueueManager(BaseManager): pass
#Connect to server
m = QueueManager(address=('', 50000), authkey='password')
spacecowboy / picasa_download.rb
Created Aug 9, 2011 — forked from jubo/picasa_download.rb
Backs up all the photos from Google Picasa Web Albums. Multithreaded
View picasa_download.rb
# Backs up all the photos from Google Picasa Web Albums.
# The script downloads the original version of the photos, and is not limited to
# 1600x1200 thumbnails.
# Author:: Victor Costan
# Copyright:: Copyright (C) 2010 Victor Costan
# License:: MIT