This file contains hidden or 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
definition module scc | |
from StdOverloaded import class <, class == | |
from StdClass import class Ord, class Eq | |
/* | |
* Find all strongly connected components using tarjan's algorithm | |
* see: https://en.wikipedia.org/wiki/Tarjan's_strongly_connected_components_algorithm | |
* | |
* @param list of nodes together tupled with their successors |
This file contains hidden or 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/expect | |
spawn pdflatex {*}$argv | |
set latexpid $spawn_id | |
set oldresult "" | |
expect -re "^.*File .(.*). not found.*$|^.*language definition file (.*) was not foun" { | |
set result $expect_out(1,string) | |
send_user "\nTrying to install missing package\n" | |
if {$oldresult == $result} { | |
send_user "$result has been tried twice with no results\n" | |
send_user "Is this not an image? Aborting...\n" |
This file contains hidden or 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
#!/bin/bash | |
set -e | |
if [[ "$#" -ne 2 ]] || ! [[ -e "$1" ]] ||\ | |
! [[ "$2" =~ ^[0-9]+[eEpPtTgGmMkKbB]?$ ]]; then | |
echo "Usage: $0 FILE TGT" | |
echo " TGT is in bytes. Allowed suffixes: bB,kK,mM,gG,tT,pP,eE" >&2 | |
echo " The result will be outputted to stdout. The progress to stderr" >&2 | |
exit | |
fi |
This file contains hidden or 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
#!/bin/bash | |
of=a.out | |
if [ "$#" -ge 3 ] && [ "${@: -2:1}" = "-o" ]; then | |
of=${@: -1:1} | |
fi | |
clm "$@" | |
tf="$(mktemp -tp. "$(basename $0)XXXXX")" | |
mv "$of" "$tf" | |
echo -e "#!/bin/sh\ntail -n +3 \"\$0\" | base64 -d | gunzip" > "$of" | |
"$tf" -nt | gzip -9 | base64 >> "$of" |
This file contains hidden or 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
#!/bin/bash | |
set -e | |
# You can find your password by logging in to the webinterface and inspecting the password parameter. | |
# Alternatively you can dive in the javascript and figure out which hashing technique they use... | |
# You can create the table by running: | |
# CREATE TABLE IF NOT EXISTS `data` ( | |
# `amount` int(11) NOT NULL, | |
# `date` datetime NOT NULL, | |
# `description` text NOT NULL, |
This file contains hidden or 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
implementation module while | |
import StdOverloaded, StdInt, StdString, StdBool, StdClass, StdList | |
import Control.Monad | |
import Control.Monad.Trans | |
import Control.Monad.State | |
import Data.Functor | |
import Data.Either |
This file contains hidden or 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
#!/bin/env python | |
# -*- coding: utf-8 -*- | |
class ftitable: | |
"""Class that implements the frequencytable to integer compression data | |
structure that holds a frequency table in a single integer. It supports | |
indexing to get a specific frequency and iterating over the keys. | |
""" | |
@staticmethod |
This file contains hidden or 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 | |
# -*- coding: utf-8 -*- | |
import itertools | |
import re | |
import time | |
def check(expr, answer, **kwargs): | |
for k, v in kwargs.iteritems(): |
This file contains hidden or 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
import java.text.DateFormat; | |
import java.text.SimpleDateFormat; | |
import java.util.Date; | |
public class BinaryClock | |
{ | |
public static int[] HOURS = {0, 1, 4, 14, 15}; | |
public static int[] MINUTES = {17, 18, 21, 22, 23, 24}; | |
public static GPIOLibrary gpio; |
This file contains hidden or 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
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
import java.io.PrintWriter; | |
/** | |
* Easy to use GPIO library for raspberry pi | |
* |
NewerOlder