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
// Reduce argument | |
z := 1.0 | |
for x >= 3 { | |
x = x - 1 | |
z = z * x | |
} | |
for x < 0 { | |
if x > -1e-09 { | |
return handleSmallGammaX(x,z) | |
} |
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
func smallOkay(x, z float64) (float64, float64, bool) { | |
for x < 0 { | |
if x > -1e-09 { | |
return x, z, true | |
} | |
z = z / x | |
x = x + 1 | |
} | |
for x < 2 { | |
if x < 1e-09 { |
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
stmt = make_unique<ast::Print>(); | |
if (!SYNTAX_OPTIONAL_ADVANCE_KEYWORD(lex::KW_endl)) { | |
MUST_PARSE(parse_expr<CK_Regular>(r, lr, f, it, | |
stmt->as_a<ast::Print>().expr)); | |
} | |
if (SYNTAX_OPTIONAL_ADVANCE_KEYWORD(lex::KW_endl)) { | |
stmt->as_a<ast::Print>().endl = true; | |
} | |
SYNTAX_ADVANCE(lex::TK_Semicolon); | |
break; |
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
# | |
# A fatal error has been detected by the Java Runtime Environment: | |
# | |
# SIGSEGV (0xb) at pc=0x00002b68b0bb0590, pid=7115, tid=47728637200128 | |
# | |
# JRE version: OpenJDK Runtime Environment (7.0_51) (build 1.7.0_51-b00) | |
# Java VM: OpenJDK 64-Bit Server VM (24.45-b08 mixed mode linux-amd64 compressed oops) | |
# Problematic frame: | |
# C [libc.so.6+0x149590] __nss_hosts_lookup+0x104b0 | |
# |
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
interface Function<A, B> { | |
public B call(A arg); | |
} | |
interface Functor<F, A> { | |
public <B> F<B> fmap(Function<A, B> f); | |
} | |
class List<A> implements Functor<List, A> { | |
private ArrayList<A> lst = new ArrayList<A>(); |
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
class Sieve { | |
public static void main(String[] args) { | |
int MAX_VALUE = 10000; | |
boolean[] isComposite = new boolean[MAX_VALUE]; | |
isComposite[1] = isComposite[0] = true; | |
for (int i = 2; i*i < MAX_VALUE; i++) { | |
if (!isComposite[i]) { | |
for (int o = i*2; o < MAX_VALUE; o += i) { | |
isComposite[o] = true; | |
} |
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
char mean(char* img, int dim) { | |
int sum = 0; | |
for (int i = 0; i < dim; i++) { | |
sum += img[i]; | |
} | |
return (char)(sum/(double)dim); | |
} | |
int autothresh_book(char* img, int dim) { | |
int hiCount, loCount, hiSum, loSum; | |
char T = mean(img, dim), oldT = 0; |
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
#too short to license, so public domain | |
from wavegen import wavegen | |
from sys import stdout | |
import random | |
def tochar(sample): | |
return chr(int(sample * 127 + 127)) | |
a = wavegen(440) | |
ash = wavegen(466.16) | |
b = wavegen(493.88) |
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 python2 | |
import urllib2, json | |
from multiprocessing.dummy import Pool as ThreadPool | |
def auth_urlopen(url): | |
request = urllib2.Request(url) | |
request.add_header('Client-ID','8vbhkriv9mcwqfhar3zqfuckvcptbnq') | |
request.add_header('Accept','application/vnd.twitchtv.v2+json') | |
return urllib2.urlopen(request) |
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
abstract class Person implements Comparable<Person> { | |
protected String lastName, firstName; | |
public Person(String lastName, String firstName) { | |
this.lastName = lastName; | |
this.firstName = firstName; | |
} | |
public String fullName() { return firstName+" "+lastName; } |