Skip to content

Instantly share code, notes, and snippets.

View Leonidas-from-XIV's full-sized avatar

Marek Kubica Leonidas-from-XIV

View GitHub Profile
@Leonidas-from-XIV
Leonidas-from-XIV / gist:322986
Created March 5, 2010 18:23
Demo code on how to use Openflipbook
$(document).ready(function () {
$('#flipbook').flipbook(
['image_01',
'image_02', 'image_03',
'image_04', 'image_05',
'image_06', 'image_07',
'image_08', 'image_09',
'image_10', 'image_11',
'image_12', 'image_13',
'image_14', 'image_15',
@Leonidas-from-XIV
Leonidas-from-XIV / xsd_validator.py
Created July 8, 2010 00:34
Simple stand-alone XML Schema validator
#!/usr/bin/env python
# -*- coding: utf8 -*-
import sys
from lxml import etree
def main():
if len(sys.argv) != 3:
print >>sys.stderr, 'Usage: %s XML-file XSD-file' % sys.argv[0]
sys.exit(3)
@Leonidas-from-XIV
Leonidas-from-XIV / local.conf
Created August 7, 2010 11:23
fontconfig adjustment to reject bitmap fonts
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file to configure system font access -->
<fontconfig>
<!-- Replace Courier with a better-looking font -->
<match target="pattern" name="family">
<test name="family" qual="any"><string>Courier</string></test>
<edit name="family" mode="assign">
<!-- Other choices - Courier New, Luxi Mono -->
#!/usr/bin/env python3
# A simple script to download stuff from Game One, a show on MTV.
# This code is public domain (if not applicable, then MIT licensed)
import re, urllib.request, urllib.parse, subprocess, sys, json, posixpath
# regex to get the variables from the page that the flash player uses
variable_re = re.compile(r'var variables = (.*);')
# crude regex to convert JS-dict syntax into JSON syntax
jsonize_re = re.compile(r' (\w+):')
# regex to get the path to the SWF file
@Leonidas-from-XIV
Leonidas-from-XIV / gist:655272
Created October 30, 2010 12:56
zeropunctuation-dl
#!/usr/bin/env python3
# A downloader for Zero Punctuation episodes. Grabs them from the internet
# and saves them with the approriate naming into the folder. The name is
# determined automatically from the web site.
# Licensed under GPLv3, fwiw.
import sys, urllib.request, re, json
# the browser that we are going to pretend we are
# yay for increasing Firefox and Linux marketshare)
user_agent = """Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Firefox/3.6.12"""
@Leonidas-from-XIV
Leonidas-from-XIV / .gitignore
Created November 29, 2010 18:57
Karma tracker for IRC channels
*.sw[p|o]
*.log
@Leonidas-from-XIV
Leonidas-from-XIV / laughingman.ps
Created January 11, 2011 13:54
Animations in PostScript, each frage on own page
%!PS-Adobe-3.0
%%BoundingBox 80 210 510 590
%%Title: (The Laughing Man logo)
%%Creator: (Marek Kubica <marek@xivilization.net>)
%%EndComments
% blue
/Fgcolor { [ 0 75 115 ] { 255 div } forall } def
% white
/Bgcolor { 1 1 1 } def
@Leonidas-from-XIV
Leonidas-from-XIV / color.clj
Created February 1, 2011 22:36
Shortened example
(ns karmawhore.color
(:use [clojure.contrib.str-utils :only (str-join)]))
(def force-color false)
(defn- fill-color [color]
(if force-color ""
(format sgr-template (sgr-colors color))))
(defn colorize [color text]
javascript: (function(){var insertLink=1;var n=0;while(document.getElementsByTagName("object")[n]!=undefined){var currentElement=document.getElementsByTagName("object")[n];if(currentElement.getElementsByTagName("embed")[0]!=undefined)if((currentElement.getElementsByTagName("embed")[0].src.indexOf("http://www.youtube.com/")==0)||(currentElement.getElementsByTagName("embed")[0].src.indexOf("http://www.youtube-nocookie.com/")==0)){var newElement=document.createElement('iframe');newElement.setAttribute('class','youtube-player');newElement.setAttribute('width',currentElement.width);newElement.setAttribute('height',currentElement.height);var src=currentElement.getElementsByTagName("embed")[0].src;newElement.setAttribute('frameborder','0');src=src.replace('.com/v/','.com/embed/');src=src.split('&')[0];newElement.setAttribute('src',src);currentElement.parentNode.insertBefore(newElement,currentElement);if(insertLink==1){var link=document.createElement('a');link.setAttribute('href','http://www.youtube.com/watch?v='+src
@Leonidas-from-XIV
Leonidas-from-XIV / gist:980798
Created May 19, 2011 13:52
Constructors? We don't do these around here.
Canberra.Proplist proplist;
Canberra.Proplist.create(out proplist);