This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import xml.etree.ElementTree | |
# in order for this script to work, manually do the following: | |
# 1) delete extraneous 'uppername="PUID"' at line 205 of cinterface.xml | |
# 2) delete '------------ ... ----' lines (there're 2 of them) | |
def un_camel(text): # slightly modified piece of code from StackOverflow.com | |
result, length = "", len(text) | |
for pos in range(length): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename... T> struct type {}; | |
struct A{}; struct B{}; struct C{}; struct D{}; struct E{}; struct F{}; | |
struct G{}; struct H{}; struct I{}; struct J{}; struct K{}; struct L{}; | |
struct M{}; struct N{}; struct O{}; struct P{}; | |
typedef type<A, B, type<C, D>, type<E, F, type<G, H>, I, J>, | |
type<type<type<K, type<L>>, M>, N>, O, P> init; | |
typedef type<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> expected; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from urllib2 import urlopen | |
import re | |
import time | |
class DegreeProgramInfo: | |
regexp = re.compile( | |
r"\d</td>\s*<td>\s*(\d+)</td>\s*(?:<td>[^<]*</td>\s*){5}<td>([^<]+)</td>", | |
re.MULTILINE | re.UNICODE) | |
def __init__(self, id, name, url, places): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'numtheory' # gem install ruby-numtheory | |
def product(arr) | |
def rec_product(n, step, arr) | |
return arr[n] if step > n | |
newstep = step << 1 | |
t = rec_product(n, newstep, arr) * | |
rec_product(n-step, newstep, arr) | |
return t | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* to compile: | |
valac --pkg gio-2.0 clem_info.vala | |
example of usage: | |
clem_info '${artist} - ${title}; elapsed: ${elapsed}/${time}' | |
*/ | |
[DBus (name = "org.freedesktop.MediaPlayer")] | |
interface Player : Object { | |
public abstract HashTable<string, Variant> GetMetadata() throws IOError; |
NewerOlder