Skip to content

Instantly share code, notes, and snippets.

View ryankirkman's full-sized avatar

Ryan Kirkman ryankirkman

View GitHub Profile
@ryankirkman
ryankirkman / parse_query.cs
Last active August 29, 2015 13:59
get rank from parse
var query = from gameScore in ParseObject.GetQuery("GameScore")
orderby gameScore.Get<int>("score") descending
select gameScore;
var rank = await query.CountAsync();
@ryankirkman
ryankirkman / keybase.md
Created July 4, 2014 02:10
keybase verification

Keybase proof

I hereby claim:

  • I am ryankirkman on github.
  • I am ryankirkman (https://keybase.io/ryankirkman) on keybase.
  • I have a public key whose fingerprint is 8741 9A15 5966 3AA5 4D94 7E20 C57E 59F3 7106 4090

To claim this, I am signing this object:

@ryankirkman
ryankirkman / include_bashrc
Created September 28, 2014 04:45
Nice git repo search (like ack) with grep speed
# Please see: http://travisjeffery.com/b/2012/02/search-a-git-repo-like-a-ninja/
alias gg='git grep -E --break --heading --line-number'
# Case insensitive search
alias ggi='gg -i'
server {
root /var/www/example.com/static;
server_name example.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
try_files /maintenance.html @proxy;
location @proxy {
proxy_pass http://127.0.0.1:10001;
import mmap
import sys
import struct
def main(in_file, out_file):
with open(in_file, "r+b") as f:
map = mmap.mmap(f.fileno(), 0)
data = map.readline()
# Assuming first char is \x00 and
# data is in blocks of 3.
@ryankirkman
ryankirkman / node-pdfcrowd.js
Created March 23, 2011 23:24
Trying to make a node.js module to interact with pdfcrowd
var sys = require('sys');
var fs = require('fs');
var restler = require('restler');
exports.generate_pdf = function(username, api_key, src_data, res) {
console.log("starting to generate pdf");
console.log(username);
console.log(api_key);
console.log(src_data);
@ryankirkman
ryankirkman / auth_to_expressjs_with_curl.sh
Created March 29, 2011 08:43
How to authenticate to an express.js web service with curl
#!/bin/sh
## Save cookies to the "cookies.txt" file
## Assumes the web service expects username
## and password in a JSON object, submitted via POST.
curl --cookie-jar cookies.txt -H "Content-Type: application/json" -X POST http://localhost:3000/user/login -d "{\"username\": \"YOURUSERNAME\", \"password\": \"YOURPASSWORD\"}"
## Now to use the authenticated session:
## (Assuming your web service speaks JSON)
curl --cookie cookies.txt -X GET http://localhost:3000/user/SOMEID
@ryankirkman
ryankirkman / gist:981041
Created May 19, 2011 15:32
cluster stack traces
TypeError: Object #<Object> has no method 'on'
at Worker.start (./node_modules/cluster/lib/worker.js:83:17)
at Socket.<anonymous> (./node_modules/cluster/lib/master.js:258:16)
at Socket.emit (events.js:61:17)
at Socket._onConnect (net.js:587:12)
at IOWatcher.onWritable [as callback] (net.js:186:12)
Error: Socket is not writable
at Socket._writeOut (net.js:392:11)
at Socket.write (net.js:378:17)
@ryankirkman
ryankirkman / gist:981400
Created May 19, 2011 18:27
dead workers
[Thu, 19 May 2011 18:18:04 GMT] INFO spawned worker 0
[Thu, 19 May 2011 18:18:04 GMT] ERROR worker 3 died
[Thu, 19 May 2011 18:18:04 GMT] INFO spawned worker 3
[Thu, 19 May 2011 18:18:04 GMT] ERROR worker 1 died
[Thu, 19 May 2011 18:18:04 GMT] INFO spawned worker 1
[Thu, 19 May 2011 18:26:00 GMT] INFO master started
[Thu, 19 May 2011 18:26:00 GMT] INFO spawned worker 0
[Thu, 19 May 2011 18:26:00 GMT] INFO spawned worker 1
[Thu, 19 May 2011 18:26:00 GMT] INFO spawned worker 2
[Thu, 19 May 2011 18:26:00 GMT] INFO spawned worker 3
Cluster detected over 20 worker deaths in the first
20 seconds of life, there is most likely
a serious issue with your server.
aborting.
info - master started
info - worker 0 spawned
info - worker 1 spawned