Skip to content

Instantly share code, notes, and snippets.

View randysecrist's full-sized avatar

Randy Secrist randysecrist

View GitHub Profile
@randysecrist
randysecrist / gfortran.rb
Created October 21, 2011 04:20
proposal - draft for gfortran formula
require 'formula'
class GfortranPkgDownloadStrategy <CurlDownloadStrategy
def stage
# The 4.2.4 compiler is distributed as a OS X 10.5
# package- a single flat xar archive instead of a
# bundle.
safe_system "/usr/bin/xar -xf #{@tarball_path}"
chdir
@randysecrist
randysecrist / twitter.py
Created October 24, 2011 19:01
simple twitter feed in python
#!/usr/bin/env python
import getpass
import urllib, urllib2
import base64
import json
import time
def fetch(uri, username='', password='', data=None):
@randysecrist
randysecrist / IntegTest.java
Created November 15, 2011 23:36
java client - secondary index integration test
import java.io.IOException;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import junit.framework.TestCase;
import com.basho.riak.client.IRiakObject;
import com.basho.riak.client.builders.RiakObjectBuilder;
@randysecrist
randysecrist / mirth-nowebstart.sh
Created December 22, 2011 23:32
Run mirth client standalone from trunk
# Run this from trunk/client
# to run mirth standalone, without having to do any strange
# webstart foo
SERVER_EXT=dist/extensions
java -cp dist/mirth-client.jar:lib/mirth-client-core.jar:lib/dicom-shared.jar:lib/file-shared.jar:lib/jdbc-shared.jar:lib/js-shared.jar:lib/smtp-shared.jar:lib/vm-shared.jar:lib/doc-shared.jar:lib/http-shared.jar:lib/jms-shared.jar:lib/mllp-shared.jar:lib/tcp-shared.jar:lib/ws-shared.jar:lib/mirth-crypto.jar:lib/mirth-vocab.jar:lib/bcprov-jdk16-144.jar:lib/commons-codec-1.5.jar:lib/commons-collections-3.2.1.jar:lib/commons-httpclient-3.0.1.jar:lib/commons-io-2.1.jar:lib/commons-lang-2.6.jar:lib/commons-logging-1.1.1.jar:lib/databinding-0.8.0.jar:lib/hapi-1.1.jar:lib/l2fprod-common-sheet.jar:lib/log4j-1.2.15.jar:lib/looks-2.3.1.jar:lib/not-yet-commons-ssl-0.3.11.jar:lib/rhino-1.7r3pre.jar:lib/swingx-1.6.jar:lib/wizard.jar:lib/xercesImpl-2.9.1.jar:lib/xpp3_min-1.1.4c.jar:lib/xstream-1.3.jar:$SERVER_EXT/vm/vm-client.jar:$SERVER_EXT/smtp/smtp-client.jar:$SERVER_EXT/rulebuilder/rulebu
@randysecrist
randysecrist / riak-ruby-map-reduce.rb
Created February 13, 2012 20:33
Riak wiki map reduce example that counts words in plain text files, using the ruby client.
require 'riak'
client = Riak::Client.new(:protocol => 'pbc')
map_phase = <<-EOF
function(v) {
var m = v.values[0].data.toLowerCase().match(/\\w*/g);
var r = [];
for(var i in m) {
if(m[i] != '') {
var o = {};
@randysecrist
randysecrist / handy_commands
Created February 15, 2012 21:39
handy shell script commands
# Passing a list of files to mHealth
for i in `find . -name "*.hl7"`
do
curl -X PUT -H "Content-Type: application/octet-stream" -i 'http://localhost:9292/v2/health/data/hl7?oauth_token=4b5f64eb-0679-4521-97be-a705fd2615c0' --data-binary @$i
done
# rename extension for files in current (and all sub) directories.
for i in `find . -name "*.txt"`
do
mv "$i" "${i%.txt}.hl7"
@randysecrist
randysecrist / Triangle.java
Created February 23, 2012 21:32
Helping Dusting learn Java
public class Triangle {
private int a, b, c;
public Triangle( int a, int b, int c ) {
this.a = a;
this.b = b;
this.c = c;
@randysecrist
randysecrist / spidermonkey_fail
Created March 6, 2012 19:16
xcode 4.3, erlang r14b04, os x 10.7.3, riak latest
2012-03-06 11:09:24 =ERROR REPORT====
Error loading "erlang_js_drv": "dlopen(/Users/randy/dev/views/riak/dev/dev1/lib/erlang_js-1.0.1/priv/erlang_js_drv.so, 2): Symbol not found: _begin_request\n Referenced from: /Users/randy/dev/views/riak/dev/dev1/lib/erlang_js-1.0.1/priv/erlang_js_drv.so\n Expected in: flat namespace\n in /Users/randy/dev/views/riak/dev/dev1/lib/erlang_js-1.0.1/priv/erlang_js_drv.so"
2012-03-06 11:09:24 =CRASH REPORT====
crasher:
initial call: supervisor:erlang_js_sup/1
pid: <0.243.0>
registered_name: erlang_js_sup
exception exit: {bad_return_value,{error,{load_error,"Failed to load spidermonkey_drv.so"}}}
in function gen_server:init_it/6
in call from proc_lib:init_p_do_apply/3
@randysecrist
randysecrist / gist:1994620
Created March 7, 2012 17:41
osx-gcc-installer, erlang r14b04, os x 10.7.3
cc -o prlink.o -c -m32 -Wall -fno-common -pthread -O2 -fPIC -UDEBUG -DNDEBUG=1 -DXP_UNIX=1 -DDARWIN=1 -DHAVE_BSD_FLOCK=1 -DHAVE_SOCKLEN_T=1 -DXP_MACOSX=1 -DHAVE_LCHOWN=1 -DHAVE_STRERROR=1 -DFORCE_PR_LOG -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM -D_NSPR_BUILD_ -I../../../dist/include/nspr -I../../../pr/include -I../../../pr/include/private -I/Developer/Headers/FlatCarbon prlink.c
prlink.c:48:27: error: CodeFragments.h: No such file or directory
prlink.c:49:23: error: TextUtils.h: No such file or directory
prlink.c:50:19: error: Types.h: No such file or directory
prlink.c:51:21: error: Aliases.h: No such file or directory
prlink.c:52:19: error: CFURL.h: No such file or directory
prlink.c:53:22: error: CFBundle.h: No such file or directory
prlink.c:54:22: error: CFString.h: No such file or directory
prlink.c:55:26: error: CFDictionary.h: No such file or directory
prlink.c:56:20: error: CFData.h: No such file or directory
@randysecrist
randysecrist / stats
Created March 9, 2012 03:49
stats from riak
root@server-55:/srv/api/current# curl 'http://<redacted>:8098/stats' | python -mjson.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
102 3284 102 3284 0 0 23144 0 --:--:-- --:--:-- --:--:-- 24147
{
"basho_metrics_version": "1.0.0",
"basho_stats_version": "1.0.1",
"bitcask_version": "1.3.0",
"cluster_info_version": "1.2.0",
"connected_nodes": [