View termtris.pas
{ | |
| termtris: a console mode frontend for learntris, written in free pascal. | |
| copyright 2013 michal j wallace. all rights reserved. | |
| available to the public under the terms of the MIT/X11 license. | |
} | |
{$mode objfpc} {$H+} | |
program termtris; | |
uses | |
kvm, kbd, cw, | |
process, |
View gridsort.py
# this is just the third step | |
input = [ 2, 8, 3, 5 ] # an array of unique items | |
n = len(input) | |
# (...) | |
order = [ 3, 0, 2, 1 ] # first two steps created this | |
output = [ 0 ] * n |
View rooms.txt
+-------------+ | |
| | | |
| room 2 | | |
| | | |
+-----+ +----+ | |
| | | |
-----------------+ +----------------- | |
<- rm 1 rm 3 -> | |
-------------------------------------- |
View something.kt
/** | |
* Created by michal on 3/25/2014. | |
*/ | |
import java.util.ArrayDeque | |
import java.util.Map; | |
import java.util.HashMap | |
trait WjData { | |
} |
View .Xdefaults
*background: black | |
*foreground: grey70 | |
font: *-fixed-*-*-*-32-* | |
xterm*faceName: Bitstream Vera Sans Mono | |
xterm*faceSize: 14 | |
xterm*vt100*foreground: grey70 | |
xterm*vt100*background: black |
View gist:10699845
# colorforth inspired programming system | |
module 'colorcode' | |
imports ['b4', 'key'], ()-> | |
$jq('#rhs') | |
.html( | |
''' | |
<div id="rhs-block" tabindex="0"/> | |
<div id="rhs-status" tabindex="1"/> | |
''') |
View hello.Mod
MODULE hello; | |
IMPORT Out := Console; | |
BEGIN Out.String("hello world"); Out.Ln; | |
END hello. |
View pcapdemo.pas
{$mode delphi} | |
program pcapdemo; | |
uses pcap, sysutils, crt; | |
procedure throw(msg:string; detail:pchar); | |
begin raise Exception.Create(msg + ': ' + detail) | |
end; | |
function IPv4ToStr(addr:dword) : string; | |
// this probably exists somewhere but i don't know where. |
View flops.py
from itertools import product, combinations, permuatations | |
ranks = 'AKQJT98765432' | |
suits = 'abcd' | |
def high_flops(): | |
# the order of the cards is relevant here | |
# suit a will be suit of leftmost card. | |
# suit b is first different suit encountered left to right. |
View rankhand.pas
{$mode delphi} | |
program rankhand; | |
uses sysutils; | |
var | |
handRankDb : array[0..32487833] of UInt32; | |
dbFile : File; | |
numRead : cardinal; | |
begin | |
Assign(dbFile, 'HandRanks.dat'); |
OlderNewer