Skip to content

Instantly share code, notes, and snippets.

View Ramblurr's full-sized avatar

Casey Link Ramblurr

View GitHub Profile
#!/usr/bin/env python
# -*- coding: latin-1 -*-
"""
svgexport.py - Batch export for Inkscape - Laurent Zubiaur
description:
Python script that can be used to automate batch exports of Inkscape objects by providing their id (set in the Object Properties dialog).
Also useful to batch export with a specific dpi (only available for individual object export in GUI mode).
For all available inkscape command line options see http://inkscape.org/doc/inkscape-man.html.
for _,event in ipairs(df.global.world.history.events) do
if event:isRelatedToHistfigID(hfig.id) then
context = df.history_event_context:new()
sentence = dfhack.with_temp_object(
df.new "string",
function(str)
event:getSentence(str, context, 1, 0)
return str.value
end
)
@Ramblurr
Ramblurr / qf-split-levels.py
Created October 31, 2013 10:07
Converts quickfort files into single level files for use with dfhack's digfort
#!/usr/bin/python
'''
Converts quickfort files into single level files for use with dfhack's digfort
The main function is to split all multiple level files into single level files,
but it also does some normalization to appease digforts simple parser.
Usage: qf-split-levels.py csv_name new-prefix
Example: qf-split-levels.py mini-moria-01-09.csv mini-moria
@Ramblurr
Ramblurr / gist:5840788
Last active December 18, 2015 20:29
Howto: Making your own guidebooks with Wiki Voyage

Custom Wiki Voyage guidebooks

Wiki Voyage, as part of the wikimedia project, has an incredibly useful tool simply called "Books". This features allows users the ability to collate various articles into a collection using the book creator tool. Wikivoyage books can be easily saved, rendered electronically in PDF, EPUB, ZIM or OpenDocument format, or ordered as a printed book.

The Help:Books page explains everything you need to know to use the feature.

Here is a sample workflow I use to create a custom guidebook for a particular region or regions.

The structure of Wiki Voyage is hierarchical with pages existing under categories. For example, "Category:Germany", is under "Category:Central_Europe" which is under "Category:Europe".

@Ramblurr
Ramblurr / gist:5840573
Last active December 18, 2015 20:29
Travel Logistics

Maps

Android

Offline maps

  • Openandromaps - free vector maps covering the whole world for outdoor sport use, work best with Locus or Oruxmaps. OSM data with tags tweaked for outdoor sports.

Trains

UnBundle 'mattn/webapi-vim'
UnBundle 'spf13/vim-autoclose'
UnBundle 'amirh/HTML-AutoCloseTag'
UnBundle 'matchit'
UnBundle 'Puppet-Syntax-Highlighting'
UnBundle 'groenewege/vim-less'
UnBundle 'tpope/vim-cucumber'
UnBundle 'tpope/vim-rails'
UnBundle 'derekwyatt/vim-sbt'
UnBundle 'derekwyatt/vim-scala'
@Ramblurr
Ramblurr / go_go_tor_relay.sh
Created November 14, 2012 14:58
Setup tor relay on debian squeeze
#!/bin/bash
####
# Simple tor relay (non-exit) setup for Debian squeeze
####
# begin user config
EXTERNAL_IP= # your external ip
MAX_MONTHLY_BW= # maximum GB per month you can spare for a tor relay
NICKNAME=atorrelay # custom nickname (will show in tor directory)
RELAY_PORT=443 # port to accept incoming connections on (open in your firewall!)
@Ramblurr
Ramblurr / owncloud.sh
Created August 13, 2012 16:18 — forked from dirkk0/owncloud.sh
owncloud installation on Amazon EC2
#!/bin/bash
VERSION=4.0.6 # desired owncloud version
if [[ $EUID -ne 0 ]]; then
echo "You must be a root user" 2>&1
exit 1
fi
@Ramblurr
Ramblurr / key32to16.py
Created December 7, 2011 21:51
Converts a base32 encoded string to a base 16 string
#!/usr/bin/env python2
# Converts a base32 encoded string to a base 16 string
# requires numconv package
import numconv
import re
google_key = raw_input("Google key: ")
@Ramblurr
Ramblurr / scorer.py
Created April 29, 2011 23:28
Iterated Prisoner's Dilemma Scorer
#! /usr/bin/python
#
# Iterated prisoner's dilemma King of Hill Script Argument is a
# directory. We find all the executables therein, and run all possible
# binary combinations (including self-plays (which only count once!)).
import subprocess
import os
import sys
RESULTS = {"cc":(2,"K"), "ct":(-1,"R"), "tc":(4,"S"), "tt":(1,"E")}