Skip to content

Instantly share code, notes, and snippets.

View ryanfb's full-sized avatar

Ryan Baumann ryanfb

View GitHub Profile
@allanmac
allanmac / sha256.cu
Last active November 10, 2023 01:26
A CUDA SHA-256 subroutine using macro expansion
// -*- compile-command: "nvcc -m 32 -arch sm_35 -Xptxas=-v,-abi=no -cubin sha256.cu"; -*-
//
// Copyright 2013 Allan MacKinnon <allanmac@alum.mit.edu>
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
@acairns
acairns / publish
Created January 5, 2014 11:58
Bash script to publish Jekyll post from _drafts into _posts
#!/bin/sh
if [ -z "$1" ]
then
echo "No draft file found"
exit
fi
mv $1 _posts/`date +"%Y-%m-%d"`-`basename $1`
@ryanfb
ryanfb / README.md
Last active December 31, 2015 21:29
Lace hOCR + PDF recombination

Lace hOCR + PDF recombination

Use the lace branch of my fork of HocrConverter: https://github.com/ryanfb/HocrConverter/tree/lace (make sure you git pull to get the latest changes)

Download and compile jbig2enc in your script path. Modify pdf.py to use 300 instead of 72 dpi.

Example run:

./lace2pdf.sh xenophon04xeno

<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<!--
Author: Rod Page
Source: http://iphylo.blogspot.com/2011/07/correcting-ocr-using-hocr-firefox.html#comment-400434491
-->
<xsl:output method='html' version='1.0' encoding='utf-8' indent='yes'/>
<xsl:variable name="scale" select="800 div //page/@width" />
@valpackett
valpackett / Alfred-Pinboard-INSTANT.md
Last active September 7, 2023 21:01
INSTANT Pinboard search from Alfred 2

INSTANT Pinboard search from Alfred 2

I've had a Python script that makes an HTML Bookmarks file for LaunchBar.
Now that I use Alfred 2, I modified it to make XML for Alfred.
This allows me to search my bookmarks with GREP SPEED!

Installation

First, add your token (from pinboard.in/settings/password) to ~/.netrc

@rrrodrigo
rrrodrigo / instagram-download.txt
Created April 10, 2012 11:45
How to download all your Instagram pictures in highest resolution without using any API
Following the news about Facebook buying Instagram I decided to delete my Instagram account before Facebook claims ownership of my pictures.
Since the Instagram-recommended (in their FAQ): http://instaport.me/export doesn't work for me (probably they can't cope with the high demand),
here is a quick and dirty way to download all my Instagram pictures in their highest resolution in a few easy steps.
You will need: Firefox, Firebug, some text editor, wget
1. Go to http://statigr.am/yourlogin using Firefox with Firebug extension active
2. Scroll down as many times as it is needed to have all yor pictures thumbnails displayed (I had some 3 hundred pictures so it was not that much scrolling, YMMV)
3. In the Firebug JS console run this JS code: $(".lienPhotoGrid a img").each(function(index) { console.log($(this).attr('src')) })
4. JS console will contain urls to all the thumbnails images, like this: http://distilleryimage1.s3.amazonaws.com/4ed46cf2801511e1b9f1123138140926_5.jpg
@codingjester
codingjester / oauth_tumblr.py
Created April 3, 2012 23:33
OAuth Tumblr Getting Access Tokens
import urlparse
import oauth2 as oauth
consumer_key = 'consumer_key'
consumer_secret = 'consumer_secret'
request_token_url = 'http://www.tumblr.com/oauth/request_token'
access_token_url = 'http://www.tumblr.com/oauth/access_token'
authorize_url = 'http://www.tumblr.com/oauth/authorize'
@raws
raws / hector.conf
Created January 4, 2012 03:36
Hector Upstart config
description "Hector IRC server"
env LC_CTYPE=en_US.UTF-8
env RBENV_VERSION=1.9.3-p0
env HECTOR_ROOT=/home/ross/hector/blolol.hect
script
/home/ross/.rbenv/bin/rbenv exec hector daemon
end script
@hcayless
hcayless / gist:1328970
Created October 31, 2011 21:12
migration error
13928:
ready
ready
rake aborted!
An error has occurred, all later migrations canceled:
private method `gsub' called for nil:NilClass
/usr/local/rvm/rubies/jruby-1.6.2/lib/ruby/1.8/cgi.rb:342:in `escape'
./db/migrate//20110811204557_escape_comments.rb:5:in `up'
org/jruby/RubyArray.java:1602:in `each'
@ryanfb
ryanfb / gist:955889
Created May 4, 2011 19:50
automatic git changelog from tags
# major versions only
prever=""; for ver in `git tag | grep -v rc | gsort -V -r`; do if [ "$prever" != "" ]; then echo $prever; git rev-list --pretty=oneline --abbrev-commit --no-merges $prever ^$ver; echo ""; fi; prever=$ver; done | less
# RC's only
prever=""; for ver in `git tag | grep rc | gsort -V -r`; do if [ "$prever" != "" ]; then echo $prever; git rev-list --pretty=oneline --abbrev-commit --no-merges $prever ^$ver; echo ""; fi; prever=$ver; done | less