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
// A fun little experiment making boolean circuits with channels | |
// It's pretty slow (especially with GOMAXPROCS > 1), but neat | |
// Originally, I had made all the gates structs with methods, etc, | |
// but they can all be done as functions thanks to closures/gc. | |
package circ | |
func NAND(in1, in2 <-chan bool) <-chan bool { | |
out := make(chan bool) | |
go func() { | |
for { |
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/python | |
""" | |
A python interpreter for the esoteric language ><> (fish). Not very elegantly coded, but it works. | |
More information: http://esolangs.org/wiki/Fish | |
""" |
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 random, sys | |
def br(): | |
c = random.randint(1,5) | |
if c == 5: | |
return chr(5) | |
else: | |
return chr(2) |
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 <stdlib.h> | |
#include <string.h> | |
#define QUICKSLICE(SLICETYPE, SLICENAME) \ | |
typedef struct SLICENAME { \ | |
unsigned int len, cap; \ | |
SLICETYPE *data; \ | |
} SLICENAME; \ | |
typedef SLICETYPE (SLICENAME ## _mapper) (SLICETYPE); \ | |
typedef char (SLICENAME ## _folder) (SLICETYPE); \ |
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
PACKAGE | |
package example | |
import "example" | |
This is the package comment, a top-level piece of documentation | |
used to explain things about the package (see json or exp/template) | |
All godoc comments are in this form | |
with no whitespace between them and what they accompany |
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
package damn | |
import ( | |
"os" | |
"bytes" | |
) | |
type PacketBody struct { | |
Args map[string]string | |
Body string |
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
========= ./examples/1linefac.pet ========= | |
fac:=|x{if(x|{x*fac(x-1)}|{1})}main:=|{x:=2*2y:=6+1print("fac(x)"fac(x)"fac(y)"fac(y))}main() | |
-------------------------------------- | |
fac(x) 24 fac(y) 5040 | |
========= ./examples/badscope.pet ========= |
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 pyaudio, threading, base64, speex, audioop, socket, sys | |
class Packet: | |
""" Use this class to parse dAmn packets. | |
Data is stored in the attributes cmd, param, | |
args, body and raw. | |
""" | |
def __init__(self, data=None, sep='='): | |
self.cmd, self.param, self.args, self.body, self.raw = None, None, {}, None, data |
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
func wrapHandler(f func(user, request), perm int) func(request) { | |
return func(r request) { | |
user := getuser(r) | |
if user.priv < perm { | |
write("no permission foo'!") | |
} else { | |
f(user, r) | |
} | |
} | |
} |
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
// ==UserScript== | |
// @match https://plus.google.com/* | |
// ==/UserScript== | |
var s = document.createElement("style"); | |
s.type = "text/css"; | |
s.innerText = ".w5faHc {display: none;} .ncGWdc, .v1WCLe, .SG, .Te { width: auto;}"; | |
document.head.appendChild(s); |
OlderNewer