Skip to content

Instantly share code, notes, and snippets.

bash-3.2$ io
Io 20090105
Io> respond_to := method( o, m, retv := true; e := try( o m ); e catch(Exception, if( e error containsSeq(" does not respond to "), retv = false)); retv)
==> method(o, m,
retv := true; e := try(o m); e catch(Exception, if(e error containsSeq(" does not respond to "), retv = false)); retv
)
Io> O := Object clone
==> O_0x100441870:
type = "O"
#ifndef _hashtable_h_
#define _hashtable_h_ 1
typedef struct hashtable_list_item {
char* key;
char* value;
struct hashtable_list_item* next;
} hashtable_list_item;
#include "hashtable.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
void
hashtable_error(char* msg) {
puts(msg);
}
(defun undo-only (&optional arg)
"Undo some previous changes.
Repeat this command to undo more changes.
A numeric ARG serves as a repeat count.
Contrary to `undo', this will not redo a previous undo."
(interactive "*p")
(let ((undo-no-redo t))
(undo arg)
;; assume undo succeeded and overwrite
;; what it wrote.
;; make the following change to undo so that the user sees 'Undo!'
;; instead of 'Redo!' in the echo area when running undo-only.
;;
;;
;;
;; < (if equiv "Redo in region!" "Undo in region!")
;; < (if equiv "Redo!" "Undo!"))))
;; ---
;; > (if (and equiv (not undo-more))
;; > "Redo in region!"
### Keybase proof
I hereby claim:
* I am clarkgrubb on github.
* I am clarkgrubb (https://keybase.io/clarkgrubb) on keybase.
* I have a public key whose fingerprint is 8A7A 4632 8348 247F C4F9 8473 34E1 8684 4526 9D1B
To claim this, I am signing this object:
#!/usr/bin/env python3
import sys
from numpy import mean, log
from scipy.special import digamma, polygamma
import scipy.stats as stats
# Estimate Gamma parameters using MLE. Algorithm described here:
#
# http://research.microsoft.com/en-us/um/people/minka/papers/minka-gamma.pdf
@clarkgrubb
clarkgrubb / gist:1157508
Created August 19, 2011 18:00
isset is the logical negation of is_null
$ uname -v
Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386
$ php --version
PHP 5.3.4 (cli) (built: Dec 15 2010 12:15:07)
$ php -a
Interactive mode enabled
<?
$ cat ./hash_dict.py
#!/usr/bin/env python3
import hashlib
import json
def hash_dict(data):
m = hashlib.sha1()
m.update(json.dumps(data, sort_keys=True).encode('utf-8'))
return m.hexdigest()[:12]
$ cat zoo.quizzes.json | jq -r '.quiz.metadata.quizLink' | sed $'s/./&\\\n/g' | awk '{cnt[$0] += 1} END {for (i in cnt) print cnt[i], i}' | sort -nr
22105 -
13265 e
9753 o
9501 a
7662 t
7502 r
7352 i
7274 h
6593 s