Skip to content

Instantly share code, notes, and snippets.

@flying-sheep
flying-sheep / splitpdf.sh
Last active May 17, 2017 10:58
split up “nup”d PDFs. depends on pdfjam and pdftk
#!/bin/bash
# some PDFs are only delivered with multiple pages “nup”d onto one,
# e.g. 4 slides arranged 2×2 on one PDF page. This script separates them.
# horizontal×vertical nup layout, e.g.: '1x1' '2x2', '1x2'
NUP='1x1'
# When re-nuping, add a frame? 'true' or 'false'
FRAME='false'
@flying-sheep
flying-sheep / bordered tiling.tikz
Created June 1, 2011 11:18
A quick hack of how you can derive tiles for automatic tiling from three source tiles (you can cramp the third one – the corners – into the second, since the space there isn’t needed)
\usetikzlibrary{calc}
\begin{tikzpicture}
\def\b{.2}
\def\ts{1.5}
\tikzstyle{glass}=[fill opacity=0.1]
\coordinate (empty) at (0,0);
\coordinate (borders) at ($(empty) + (\ts+\b, 0)$);
\coordinate (corners) at ($(borders) + (\ts+\b, 0)$);
@flying-sheep
flying-sheep / Extractor.boo
Created June 4, 2011 18:57
Terraria Sprite Extractor
namespace WindowsGame2
import System.IO
import Microsoft.Xna.Framework
public class Extractor(Game):
private graphics as GraphicsDeviceManager
private basePath as string
private outPath as string
@flying-sheep
flying-sheep / markdowner.py
Created June 12, 2011 15:41
script to open markdown files. made by jezra, tweaks by me (can now open files)
#!/usr/bin/env python
'''
Hey, this is GPLv3 and copyright 2010 Jezra
'''
import sys, os
import gtk
import webkit
import markdown #http://www.freewisdom.org/projects/python-markdown/
@flying-sheep
flying-sheep / mockup.py
Created July 13, 2011 22:58
Mockup/prototype of a toolbarified page bar in okular
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
app = QApplication(sys.argv)
window = QMainWindow()
@flying-sheep
flying-sheep / remember
Created July 16, 2011 22:00
A perl script to notify oneself
#!/usr/bin/env perl
use strict;
use warnings;
use autodie;
use feature 'switch';
use English '-no_match_vars';
$| = 1;
my $msg = '';
@flying-sheep
flying-sheep / mde_login.py
Created August 3, 2011 22:32 — forked from martinth/mde_login.py
mode.de login script
# -*- coding: utf-8 -*-
import cookielib
from urllib2 import HTTPCookieProcessor, build_opener
from urllib import urlencode
from BeautifulSoup import BeautifulSoup
# the login data
login_data = {
'login_username': u'USERNAME',
'login_password': u'PASSWORD',
@flying-sheep
flying-sheep / assertion_hook.py
Created August 8, 2011 21:34 — forked from martinth/assertion_hook.py
A sample exception hook, that prints useful information if an AssertionError occures
#!/usr/bin/env python3
import sys, pprint
import os.path
# save old exception hook
sys._old_excepthook = sys.excepthook
def assert_hook(exc_type, exception, traceback):
if exc_type.__name__ == "AssertionError":
@flying-sheep
flying-sheep / fix_jar_mime.sh
Created September 29, 2011 14:41
A bug exists for ages in Kubuntu (and afaik only there) that can be fixed by removing a superfluous file and rebuilding the MIME DB.
#!/bin/bash
ROOT_UID=0
FIX_JAR_MIME="rm -vf /usr/share/mime/packages/sun-java*-jre.xml
update-mime-database /usr/share/mime"
if [ "$UID" -ne "$ROOT_UID" ]; then
kdesudo -c "$FIX_JAR_MIME"
kbuildsycoca4 #only possible if run as underprivileged
else
"$FIX_JAR_MIME"
@flying-sheep
flying-sheep / scala_funcgen.py
Created August 12, 2012 15:24
Scala Function & Tuple generator for java
#!/usr/bin/env python3
'''
A script to generate the barebone implementation of scala’s
Function# and Tuple# types for use in java.
I made this to allow Java projects to specify function signatures
which play nice with scala, without depending on scala’s stdlib.
'''