Skip to content

Instantly share code, notes, and snippets.

View danlentz's full-sized avatar

Dan Lentz danlentz

View GitHub Profile
We couldn’t find that file to show.
@mrflip
mrflip / son_of_a_batch-output.log
Created April 25, 2011 05:32
son_of_a_batch is a tool we'll be releasing soon. Here I make 1 request to son_of_a_batch, which make 100 concurrent requests against the Infochimps API, returning the 100-long result set in < 1.2s.
curl -H "Content-Type: application/json" --data-ascii '{ "_pretty":true, "_show_stats":true, "_timeout":1.9, "url_base":"http://api.infochimps.com/social/network/tw/influence/trstrank.json?_apikey='$APIKEY'&user_id=", "url_vals":"'`cat /tmp/strong_links_ids.txt`'" }' -v 'http://localhost:9004/batch.json'
* About to connect() to localhost port 9004 (#0)
* Trying ::1... Connection refused
* Trying fe80::1... Connection refused
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 9004 (#0)
> POST /batch.json HTTP/1.1
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
> Host: localhost:9004
> Accept: */*
@dekz
dekz / google api
Created May 12, 2011 04:16
google api
clientID = ''
clientSecret = ''
redirectURI = 'urn:ietf:wg:oauth:2.0:oob'
code = ''
https = require 'https'
http = require 'http'
querystring = require 'querystring'
getRefreshToken = ->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Stack Simulator</title>
<link rel="stylesheet" type="text/css" href="../../../resources/css/ext-all.css" />
<script type="text/javascript" src="../../../bootstrap.js"></script>
<script>
Ext.require(['Ext.chart.*', 'Ext.data.*']);
(defclass cons-presentation-mixin ()
((car-type :accessor cons-presentation-car-type
:initarg :car-type)
(cdr-type :accessor cons-presentation-cdr-type
:initarg :cdr-type))
(:documentation "A presentation for conses."))
(defclass cons-presentation (presentation cons-presentation-mixin)
()
)
I've just put up a large chunk of my Twitter archives up on the
Talis Platform service. Talis Platform is a 'cloud'-based
triplestore hosting service. More at http://n2.talis.com
A triplestore is like a database but for graphs of RDF triples.
The cool thing about RDF and the triplestore is that you
basically have a completely schema-less datastore. You don't have
to figure out "Oh, there's integers going in this field and
strings going in that". You just upload a big pile of RDF and the
triplestore keeps it all there. This is obviously not as efficient
as using a database, so if you want to grow to Google size, it may
@stuartsierra
stuartsierra / gist:1188879
Created September 2, 2011 15:14
XML parsing and clojure.zip
;;; XML parsing and clojure.zip
;;; There's got to be a cleaner way to do this.
;;; I have code like this:
(defn jdks-loc [xml-zipper]
(zip/down
(first
(filter #(let [n (zip/node %)]
@dexterous
dexterous / migrate_to_github.sh
Last active March 26, 2018 20:39
Migrating a repo to GitHub
cd path/to/git/repo
git remote add github [email protected]:${user_or_org}/${repo}.git
git remote rename origin old
for b in `git branch -r --no-color | cut -b3- | grep --color=none '^old/' | grep -v '/HEAD ' | cut -d '/' -f2`
do
git push github old/$b:refs/heads/$b
done
@stuartsierra
stuartsierra / test_clj_byte_chunk_seq.clj
Created December 13, 2011 13:43
Clojure chunked binary sequences
(ns test-clj-byte-chunk-seq
(:import (java.io InputStream OutputStream
FileInputStream FileOutputStream)))
(set! *warn-on-reflection* true)
(def ^:const ONE_MEG (* 1024 1024))
(deftype ByteArrayChunk [^bytes array ^int offset ^int end]
clojure.lang.IChunk
@sshirokov
sshirokov / sbcl-so-finder.lisp
Created January 2, 2012 04:47
A patch to help SBCL compiled cores find shared objects.
(with-unlocked-packages (:sb-alien)
(let ((function (symbol-function 'sb-alien::try-reopen-shared-object)))
(setf (symbol-function 'sb-alien::try-reopen-shared-object)
#'(lambda (obj)
"Look at the pathname of the library we are trying to re-open
and only use the full absolute path if the named file exists. Otherwise reduce the
path to the minimal relative form and defer the search to the OS dynamic linker."
(declare (type sb-alien::shared-object obj))
(let ((path (sb-alien::shared-object-pathname obj)))
(when (pathname-directory path)