Skip to content

Instantly share code, notes, and snippets.

View ryanfb's full-sized avatar

Ryan Baumann ryanfb

View GitHub Profile
@ryanfb
ryanfb / gist:13898
Created September 30, 2008 18:07 — forked from bkerley/gist:13858
proc stockgetchr html {
if {[llength [regexp -all -inline {<link rel="stylesheet".*mutualfund_styles.css">} $html]] > 0} {
set chrt [regexp -all -line -inline {<span class.?=.?"ch[rg]">\n(.*?)\n(.*?)\n} $html]
lset chrt 1 [regsub -all {&nbsp;} [lindex $chrt 1] ""]
lappend chr [lindex $chrt 1] [lindex $chrt 2]
} else {
set chrt [regexp -all -inline {<span class="ch[rg]".*?>(.*?)<} $html]
lappend chr [lindex $chrt 1] [lindex $chrt 3]
}
return $chr
#!/bin/sh
# Shell script to install your identity.pub on a remote machine
# Takes the remote machine name as an argument.
# Obviously, the remote machine must accept password authentication,
# or one of the other keys in your ssh-agent, for this to work.
ID_FILE="${HOME}/.ssh/identity.pub"
if [ "-i" = "$1" ]; then
proc uajoin args { set b [lindex $args 0]; set args [lrange $args 1 [llength $args]]; set o ""; set nlines [maxlines $args]; set newline ""; set nl ""; foreach j $args { lappend nl [uaddspaces $nlines $j]; }; for {set i 0} { $i < $nlines } { incr i } { append o $newline; set d ""; foreach k $nl { append o "$d[lindex [split $k "\n"] $i]"; set d $b; }; set newline "\n"; }; return $o; }
proc uaddspaces {x y} { set a " "; set lines [split $y "\n"]; set n [llength $lines]; set d [expr "$x - $n"]; set m [umaxstringlength $lines]; set e [string repeat $a $m]; set nlines [upadlinesto $m $lines]; set y [join $nlines "\n"]; for {set i 0} {$i < $d} {incr i} { set y "$y\n$e"; }; return $y; }
proc umaxstringlength a {set m 0; foreach j $a { set sl [ulength [strip_all $j]]; if {$m < $sl} {set m $sl}}; return $m}
proc upadlinesto {m lines} {set nlines "";set a " "; foreach j $lines { set sl [ulength [strip_all $j]]; if {$sl < $m} { set j "$j[string repeat $a [expr {$m - $sl}]]"; }; lappend nlines $j; }; return $nl
proc aapl {} {set aapl [stock aapl]; if {[regexp {\+\d} $aapl dummy]} {. [uchar f8ff 20 2708] $aapl} else {. [uchar 2708 20 f8ff] $aapl}}
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%)
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%)
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";}
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
@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!
 ̧̧̧̣̣̣̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋̌ ̧̧̧̧̧̧̧̧̧̣̣̣̣̣̣̣̣̣̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋̌̊̆̋̋̆̆̋