Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Sam Ritchie sritchie

🎯
Focusing
Block or report user

Report or block sritchie

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sritchie
sritchie / algebra.swift
Created Jun 9, 2014
Typeclasses in Swift
View algebra.swift
// Playground - noun: a place where people can play
import Cocoa
var str = "Hello, playground"
// Here's take 1. First, I defined the algebra like I would in
// Scala, as separate protocols:
protocol Semigroup {
typealias T
View thrift.clj
// First pass at a thrift parser using instaparse:
(def instagram
(insta/parser
"
Document ::= <ws> Header* Definition*
SlashComment ::= <'//'> #'[^\n]'*
PoundComment ::= <'#'> #'[^\n]'*
BlockComment ::= '/*' #'(?s).'* '*/'
Comment ::= SlashComment | PoundComment | BlockComment | <ws>
View gist.xml
<?xml version="1.0"?>
<!-- core-site.xml -->
<configuration>
<property>
<name>io.serializations</name>
<value>cascading.tuple.hadoop.BytesSerialization,cascading.tuple.hadoop.TupleSerialization,org.apache.hadoop.io.serializer.WritableSerialization,org.apache.hadoop.io.serializer.JavaSerialization</value>
</property>
</configuration>
@sritchie
sritchie / WholeFile.java
Created Feb 2, 2011
Hadoop input format for swallowing entire files.
View WholeFile.java
package forma;
import forma.WholeFileInputFormat;
import cascading.scheme.Scheme;
import cascading.tap.Tap;
import cascading.tuple.Fields;
import cascading.tuple.Tuple;
import cascading.tuple.TupleEntry;
import java.io.IOException;
import org.apache.hadoop.mapred.JobConf;
View fuck.js
(function () {function b(a){throw a;}var f=!0,h=null,j=!1;function aa(){return function(a){return a}}function k(a){return function(){return this[a]}}function m(a){return function(){return a}}var o;
function q(a){var c=typeof a;if("object"==c)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return c;var d=Object.prototype.toString.call(a);if("[object Window]"==d)return"object";if("[object Array]"==d||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==d||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==c&&"undefined"==typeof a.call)return"object";return c}function s(a){return void 0!==a}function ba(a){return"string"==typeof a}function ca(a){return a[da]||(a[da]=++ea)}var da="closure_uid_"+Math.floor(2147483648*Math.random()).toString(36),ea=0;var fa={"\x00":"\\0","\u
View globhfs.clj
(ns gist.globhfs
(:import [cascading.tap GlobHfs]))
;; ### Bucket to Cluster
;;
;;; To get tuples back out of our directory structure on S3, we employ
;; Cascading's [GlobHFS] (http://goo.gl/1Vwdo) tap, along with an
;; interface tailored for datasets stored in the MODIS sinusoidal
;; projection. For details on the globbing syntax, see
;; [here](http://goo.gl/uIEzu).
View optimus.clj
(defn optify
"Helper that examines paths with the supplied prefix and either subs
in their cache-busting URLs or returns them unchanged."
[req prefix]
(fn [^String src]
(or (and (.startsWith src prefix)
(not-empty (link/file-path req src)))
src)))
@sritchie
sritchie / fix_kanji_colorizer.py
Last active Oct 31, 2017
Instructions for how to have Kanji Colorizer not replace a field with other text in it.
View fix_kanji_colorizer.py
# This is useful for multi-Kanji words; once you've deleted everything but the first Kanji, you want
# the colorizer to leave the field alone.
# 1) Look for the line that starts with `def addKanji(note, flag=False, currentFieldIndex=None)`
# 2) Scroll down almost to the bottom of that function (where the lines are indented,
# right above the "Add a colorized..." bit of text
# 3) Replace this line:
note[dstField] = dst
View fuck.txt
_____ __ __ _______ __ __
| | | | | | / | | | / /
| ------' | | | | | ____| | | / /
| |___ | | | | | | | |/ /
| ___| | | | | | | | /
| | | | | | | |____ | \
| | | -- | | | | |\ \
|__| \________/ \______| |__| \__\
_____
View circle.yml
dependencies:
pre:
- source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list
- wget -qO- http://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
- sudo apt-get update
- sudo apt-get install rethinkdb=1.16.3~0precise
- sudo cp /etc/rethinkdb/default.conf.sample /etc/rethinkdb/instances.d/instance1.conf
- sudo /etc/init.d/rethinkdb restart
You can’t perform that action at this time.