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/perl | |
while (<>) { $hash{$_} ++ foreach split /\s+/, $_; } | |
print "$_: $hash{$_}\n" foreach sort { $hash{$a} <=> $hash{$b} } keys %hash; |
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
(* | |
Compilation: | |
$ fsc markov.fs | |
Usage: | |
$ [mono] markov.exe | |
Load a file and output in pauses | |
$ (echo "init <FILE>.txt"; for i in `seq 1 100000`; do echo $i; sleep 0.2; done; echo exit) | [mono] markov.exe | |
*) | |
open System |
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
module Minesweeper where | |
import Data.Set (Set) | |
import qualified Data.Set as Set | |
import List(transpose) | |
import Random | |
data Flag = Flag | Close | Open | |
type Number = Int |
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
<p>Hello, world!</p> |
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 | |
def sqrt_newton(x): | |
if abs(x) > 1e16: raise ValueError("Too large to be calculated accurately.") | |
f = lambda a: a ** 2 - x | |
f1 = lambda a: 2.0 * a | |
x1 = x / 2.0 | |
dx = 1e-16 * 10.0 ** (len(repr(x)) * 1.0) | |
while abs(f(x1)) > dx: | |
x1 = x1 - (f(x1) / f1(x1)) |
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
module DirectedGraphs | |
open System | |
open System.IO | |
open System.Text.RegularExpressions | |
type Conn<'a when 'a : comparison> = 'a * 'a | |
type Graph<'a when 'a : comparison> = 'a Set * 'a Conn Set | |
let eq = (=) |
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
#if INTERACTIVE | |
#r "OpenTK.dll" | |
#endif | |
open System | |
open System.Drawing | |
open System.Collections.Generic | |
open OpenTK | |
open OpenTK.Graphics |
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 | |
class Unit(object): | |
def __init__(self, value=0.0, unit={}): | |
self.value = value | |
self.unit = unit | |
@staticmethod | |
def check(unit1, unit2): | |
p1 = [ (name, unit1[name]) for name in sorted(unit1.keys()) ] |
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.io.*;import javax.tools.*;class Quine1{static final char Q=34;static final int N=1;public static void main(String[]a)throws Exception{System.out.println("This is the program "+N);String fn="Quine"+(N+1)+".java";BufferedWriter out=new BufferedWriter(new FileWriter(fn));String s="import java.io.*;import javax.tools.*;class Quine%d{static final char Q=34;static final int N=%d;public static void main(String[]a)throws Exception{System.out.println(%cThis is the program %c+N);String fn=%cQuine%c+(N+1)+%c.java%c;BufferedWriter out=new BufferedWriter(new FileWriter(fn));String s=%c%s%c;out.write(String.format(s,N+1,N+1,Q,Q,Q,Q,Q,Q,Q,s,Q,Q,Q,Q,Q));out.close();JavaCompiler c=ToolProvider.getSystemJavaCompiler();c.run(null,null,null,fn);Class.forName(%cQuine%c+(N+1)).getMethod(%cmain%c,a.getClass()).invoke(null,new Object[]{new String[]{}});}}";out.write(String.format(s,N+1,N+1,Q,Q,Q,Q,Q,Q,Q,s,Q,Q,Q,Q,Q));out.close();JavaCompiler c=ToolProvider.getSystemJavaCompiler();c.run(null,null,null,fn);Class.forName("Q |
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/perl | |
no warnings; | |
%abcdef=('g','rr','&&','x','e','g','E','E','$','li','::','n','ll',12, | |
'()','to','Z',chr(1<<5),'w','a','z',' | |
',':::','at ','@','s','x','y', | |
'tyt', eval eval '\'"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' | |
. '\\\\\\\\\\\\\\\\\\\\\\\\'.'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' | |
.'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' | |
.'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`"\'','y','z','&','t','[]','u','ax','ax','**', | |
'e','o','o','wt','r ','lx','il','b','c','c','d','ff','f',',',',','.','.','Ion', |