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
#include <windows.h> | |
#include <stdio.h> | |
#include <string> | |
/* | |
batter.c from http://mattn.kaoriya.net/software/windows/20120920154016.htm | |
*/ | |
static int emsg() { | |
char* p = NULL; |
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/python | |
import sys | |
import datetime | |
# Calculates death probabilities based on Social Security | |
# actuarial tables for a given group of people. | |
# Run with a list of ages/genders and an optional timespan (or year in the future): | |
# python actuary.py 63m 80m 75f 73m 10 |
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 HashTreeParser | |
def self.parse(*args) | |
new.parse(*args) | |
end | |
def parse(text) | |
subhash = proc {|s,k| s[k] = Hash.new(&subhash) } | |
tree = Hash.new(&subhash) | |
each_entry(text) do |name, content| |
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
require 'net/http' | |
class Couch | |
def initialize(appuri) | |
if appuri.respond_to?(:host) | |
@appuri = appuri | |
else | |
@appuri = URI(appuri.to_s) | |
end | |
end |
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
def egcd(x, y, a=0, b=1) | |
d, m = x.divmod(y) | |
return [y, a] if m == 0 | |
egcd(y, m, b - d * a, a) | |
end | |
def tex(w,h) | |
t = make_texture(w, h) | |
n = w | |
t.bucket white |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project name="JavaApplication2" default="default" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant"> | |
<description>Builds, tests, and runs the project JavaApplication2.</description> | |
<import file="nbproject/build-impl.xml"/> | |
<property name="ivy.install.version" value="2.3.0-rc1" /> | |
<property name="ivy.jar.dir" value="${basedir}/ivy" /> | |
<property name="ivy.cache.dir" value="${basedir}/ivy" /> | |
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" /> | |
<property name="ivy.lib" value="${basedir}/lib" /> |
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
$ ruby gauss.rb 1 2 3 4 5 6 7 8 9 10 10 12 | |
-- input: | |
[1 2 3 4] | |
[5 6 7 8] | |
[9 10 10 12] | |
-- forward elimination | |
(1) <-> (3) | |
(1) ÷ 9 | |
[1 10/9 10/9 4/3] | |
[5 6 7 8] |
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
# copied from http://lifc.univ-fcomte.fr/~ededu/projects/bresenham/ | |
# but POINT(y, x) is replaced by yield(x, y) | |
def thick_bresenham(from_x, from_y, to_x, to_y) | |
dx = (to_x - from_x).abs | |
dy = (to_y - from_y).abs | |
ystep = from_y < to_y ? 1 : -1 | |
xstep = from_x < to_x ? 1 : -1 | |
ddx = 2 * dx |
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
-----BEGIN PGP PUBLIC KEY BLOCK----- | |
Version: GnuPG v1.4.7 (MingW32) | |
mQGiBE/I1A8RBADMW0TeBLoqwGH3ta7KNz299lzbzT6Ml7aWlVEKZ2r+gMrM73eY | |
lH8NDJNExQmRjFXcv89K4gWEj9eJFxdAbyTRtUhC5zZnrEngV2dKp9IXAQvnxWDN | |
UwEhLPxnS4E176WYnv5FIUREVk61CrhlIzJcFIJTDxt29Fb5M3G/DzOf3wCgmOUh | |
Jn/JH2166zpPehYg4BhPuq0D/iCzPzdaIB1eyC3NwrFPXDWmY50NHIdI2PfrgM7m | |
aMMkartBdjoem7dAUqh1OAuy801WEVDeDqmCb9cGrI7+7numoo+ZKOk26PCbSVsY | |
Eo6kkvmgC7xIM16iLMMwe5OsCHUgMBSYZEISwarqiHrJnL/+vO4UlT0PIxP/Uze+ | |
ECdaBACw/jdgg6fdw69ki7UTfk24V1fQxvP88ZGb6J0QB/c6lkB4hwNC6gxsVEYZ |
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
# tweaked from http://d.hatena.ne.jp/auto_ptr/20060403#1144110624 | |
require 'time' | |
require 'kconv' | |
d = [] | |
time = nil | |
ARGF.each_line do |line| | |
case line |