Skip to content

Instantly share code, notes, and snippets.

@flying-sheep
flying-sheep / splitpdf.sh
Last active May 17, 2017
split up “nup”d PDFs. depends on pdfjam and pdftk
View splitpdf.sh
#!/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 Jun 1, 2011
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)
View bordered tiling.tikz
\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 Jun 4, 2011
Terraria Sprite Extractor
View Extractor.boo
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 Jun 12, 2011
script to open markdown files. made by jezra, tweaks by me (can now open files)
View markdowner.py
#!/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 Jul 13, 2011
Mockup/prototype of a toolbarified page bar in okular
View mockup.py
#!/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 Jul 16, 2011
A perl script to notify oneself
View remember
#!/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 Aug 3, 2011 — forked from martinth/mde_login.py
mode.de login script
View mde_login.py
# -*- 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 Aug 8, 2011 — forked from martinth/assertion_hook.py
A sample exception hook, that prints useful information if an AssertionError occures
View assertion_hook.py
#!/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 Sep 29, 2011
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.
View fix_jar_mime.sh
#!/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 Aug 12, 2012
Scala Function & Tuple generator for java
View scala_funcgen.py
#!/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.
'''
You can’t perform that action at this time.