Skip to content

Instantly share code, notes, and snippets.

View ryanfb's full-sized avatar

Ryan Baumann ryanfb

View GitHub Profile
Totals grouped by language (dominant language first):
cpp: 1528679 (52.52%)
ansic: 1124901 (38.65%)
tcl: 122533 (4.21%)
sh: 53289 (1.83%)
python: 41200 (1.42%)
fortran: 28713 (0.99%)
asm: 3565 (0.12%)
ada: 1681 (0.06%)
perl: 1312 (0.05%)
proc eotw args {set week [clock format [clock seconds] -format "%U"]; if {[lsearch [array names eotws] $week] < 0} {set a 0;set b 0;set c 0;set d 0; while {!$a} {set a [expr int(12*rand())-6]};while {!$b} {set b [expr int(12*rand())-6]};while {!$c} {set c [expr int(12*rand())-6]};while {!$d} {set d [expr int(12*rand())-6]};set eotws($week) [list [expr $a*$c] [expr $a*$d+$b*$c] [expr $b*$d]];};set a "[lindex $eotws($week) 0]x^2";set b [lindex $eotws($week) 1];if {$b > 0} {set b " + [expr $b]x"} elseif {$b eq 0} {set b ""} else {set o " - [expr abs($b)]x"};set c [lindex $eotws($week) 2];if {$c > 0} {set c " + $c" } elseif {$c eq 0} {set c ""} else {set c " - [expr abs($c)]"};return "Congratulations y = $a$b$c\nYou are the\nequation of the week";}
proc eotw args {set week [clock format [clock seconds] -format "%U"]; if {[lsearch [array names ::eotws] $week] < 0} {set a 0;set b 0;set c 0;set d 0; while {!$a} {set a [expr int(12*rand())-6]};while {!$b} {set b [expr int(12*rand())-6]};while {!$c} {set c [expr int(12*rand())-6]};while {!$d} {set d [expr int(12*rand())-6]};set ::eotws($week) [list [expr $a*$c] [expr $a*$d+$b*$c] [expr $b*$d]];};set a "[lindex $::eotws($week) 0]x^2";set b [lindex $::eotws($week) 1];if {$b > 0} {set b " + [expr $b]x"} elseif {$b eq 0} {set b ""} else {set o " - [expr abs($b)]x"};set c [lindex $::eotws($week) 2];if {$c > 0} {set c " + $c" } elseif {$c eq 0} {set c ""} else {set c " - [expr abs($c)]"};return "Congratulations y = $a$b$c\nYou are the\nequation of the week";}
Totals grouped by language (dominant language first):
cpp: 508827 (85.46%)
tcl: 50084 (8.41%)
ansic: 25569 (4.29%)
python: 10029 (1.68%)
sh: 683 (0.11%)
perl: 153 (0.03%)
csh: 30 (0.01%)
@ryanfb
ryanfb / gist:17464
Created October 17, 2008 16:42
This sequence of diacriticals will crash Terminal.app and various other Mac font renderers. Fun times!
 ̧̧̧̣̣̣̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋̌ ̧̧̧̧̧̧̧̧̧̣̣̣̣̣̣̣̣̣̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000204
Crashed Thread: 0
Thread 0 Crashed:
0 libSystem.B.dylib 0x92925d0d szone_free + 1747
1 libSystem.B.dylib 0x9292a5b4 szone_realloc + 2406
2 libSystem.B.dylib 0x92929c0e malloc_zone_realloc + 88
3 libSystem.B.dylib 0x92929b81 realloc + 209
4 libSystem.B.dylib 0x9295592f reallocf + 30
$ time 7zr x enwiki-latest-pages-meta-history.xml.7z
7-Zip (A) 4.57 Copyright (c) 1999-2007 Igor Pavlov 2007-12-06
p7zip Version 4.57 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,8 CPUs)
Processing archive: enwiki-latest-pages-meta-history.xml.7z
Extracting enwiki-latest-pages-meta-history.xml
Everything is Ok
$ time pbzip2 -d -v -p7 enwiki-latest-pages-meta-history.xml.bz2
Parallel BZIP2 v1.0.2 - by: Jeff Gilchrist [http://compression.ca]
[July 25, 2007] (uses libbzip2 by Julian Seward)
# CPUs: 7
-------------------------------------------
File #: 1 of 1
Input Name: enwiki-latest-pages-meta-history.xml.bz2
Output Name: enwiki-latest-pages-meta-history.xml
proc tag {url args} {
if { ![regexp {^http://} $url] } {
return "Usage: tcl tag [color red]URL[color] tags."
} else {
if { ![info exists ::urltags($url)] } {
set ::urltags($url) $args
} else {
set l $::urltags($url)
foreach e $args {if { [lsearch -exact $l $e] == -1 } {lappend l $e}}
set ::urltags($url) $l
@ryanfb
ryanfb / gist:30903
Created December 1, 2008 23:36
gisthead.cgi
#!/usr/bin/env ruby
require 'rubygems'
require 'hpricot'
require 'open-uri'
require "cgi"
gistbase = 'http://gist.github.com'
cgi = CGI.new