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
#include <stdio.h> | |
const char clo[64] = { | |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 6, | |
}; | |
const char b64[64] = { |
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
BEGIN { FS = ";"; OFS = ","; } | |
{ name = $2; } | |
name ~ /<.*>/ { name = $11; } | |
name { print $1, name, $3; } |
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
cartesian :: [[a]] -> [[a]] | |
cartesian [] = [[]] | |
cartesian (xs:zss) = [x:ys | x <- xs, ys <- cartesian zss] |
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
from fractions import Fraction | |
def catalan(n): | |
c = 1 | |
for k in range(2, n + 1): | |
c *= Fraction(n + k, k) | |
return int(c) |
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
from queue import PriorityQueue | |
class Field: | |
def __init__(self, size, align): | |
self.size = size | |
self.align = align | |
class Struct: | |
def __init__(self, fields): | |
size = 0 |
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
import re | |
import sre_compile | |
import sre_parse | |
from sre_constants import * | |
opcodes = dict((v,k) for (k,v) in OPCODES.items()) | |
atcodes = dict((v,k) for (k,v) in ATCODES.items()) | |
chcodes = dict((v,k) for (k,v) in CHCODES.items()) | |
def print_dis(s, indent): |
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
#!/bin/sh | |
pattern="$1" | |
shift | |
if [ $# -gt 1 ] | |
then | |
GREP_OPTIONS="$GREP_OPTIONS --with-filename" | |
export GREP_OPTIONS | |
fi |
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
#include <ctype.h> | |
#define BIT(X) (1 << (X)) | |
#define CTRL(X) ((X) - '@') | |
enum { None = -1 }; | |
enum { | |
Bold = CTRL('B'), | |
Colour = CTRL('C'), |
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
#include <limits.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
const char * | |
intern(const char *s) | |
{ | |
union tree { | |
const char *str; |
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
import java.util.Iterator; | |
public class CovariantIterator<T extends U, U> implements Iterator<U> | |
{ | |
private Iterator<T> iter; | |
public CovariantIterator(Iterator<T> it) | |
{ | |
this.iter = it; | |
} |