Skip to content

Instantly share code, notes, and snippets.

@ctrueden
ctrueden / Overflows.java
Created February 22, 2012 17:59
Benchmarks performance of several methods of detecting integer multiplication overflows.
//
// Overflows.java
//
import java.math.BigInteger;
/**
* Benchmarks performance of several methods of detecting integer overflows.
*
* @author Curtis Rueden
@axtimwalde
axtimwalde / Auto_Correlation.java
Created April 3, 2012 08:52
n-dimensional autocorrelation plugin for Fiji using ImgLib2
import ij.IJ;
import ij.ImagePlus;
import ij.plugin.PlugIn;
import mpicbg.util.RealSum;
import net.imglib2.FinalInterval;
import net.imglib2.IterableRealInterval;
import net.imglib2.RandomAccessible;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.algorithm.fft.FourierTransform;
import net.imglib2.algorithm.fft.FourierTransform.Rearrangement;
@CFPBadmin
CFPBadmin / cfpb-source-code-policy.txt
Created April 9, 2012 13:54
Consumer Financial Protection Bureau Source Code Policy
1. USE OF EXTERNAL OPEN SOURCE SOFTWARE
a) "Open Source Software" (OSS) is software that allows its recipients to modify and redistribute the source code; as such, "open source" is a copyright and distribution framework and makes no implications regarding technical support or indemnification. In almost all cases, OSS meets the definition of "commercial computer software" and shall be given appropriate statutory preference in accordance with 41 USC 264B (reference (b)) (see also FAR 2.101(b), 12_1.html 12.000, 12.101 (reference (c))).
b) Executive agencies, including CFPB, are required to conduct market research when preparing for the procurement of products or services by 41 USC Sec. 253a (reference (e)) (see also FAR 10.001. Market research for software should include OSS.
a. There are several positive aspects of OSS that should compel CFPB to seek out OSS when conducting market research on software for Bureau-wide use:
i. Publicly available source code enables continuous and broad peer review that
@Samuirai
Samuirai / captcha.md
Created June 14, 2012 20:59
G-WAN Captcha Decode

G-WAN is a new free web server. They seem to be very proud of it, or at least just want to make a lot of money. Well anyway, in almost every sentence they write, they claim that they are 20% cooler than anything else. It feels a bit arrogant. I have to admit, I don't know a lot about web servers, so I can't speak to how good they are.

However, then I saw their Captcha example. I also don't know much about machine learning algorithms, OCR, and stuff like that, but I do know how to read pixels. I also know how to compare values with python :P

demo

They say the following about their Captcha:

@teoliphant
teoliphant / life.py
Created August 14, 2012 22:03
Array-oriented version of the game of life
from numpy.random import rand
from numpy import r_, ix_, uint8, roll
import matplotlib.pyplot as plt
import time
size = 200
GRID = (rand(size,size) > 0.75).astype(uint8)
# Rotate indices because the world is round
indx = r_[0:size]
up = roll(indx, -1)
@chrissem
chrissem / build.py
Created September 11, 2012 09:16
JCC buildfile for bio-formats
#!/usr/bin/env python
import os
compiler = 'python -m jcc'
# jcc options
options = [
'build',
'install'
@jiffyclub
jiffyclub / game_of_life.ipynb
Created September 24, 2012 21:15
Conway's Game of Life in an IPython Notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@owenthereal
owenthereal / tmux-iterm2.rb
Last active December 10, 2015 11:48
Homebrew custom build script for Tmux and Iterm2.
require 'formula'
class TmuxIterm2 < Formula
url 'http://iterm2.googlecode.com/files/iTerm2-1_0_0_20121224.zip'
sha1 'a2ea1cb72f3cef193d929c1580ef82710bc7345b'
head 'git://tmux.git.sourceforge.net/gitroot/tmux/tmux'
depends_on 'pkg-config' => :build
depends_on 'libevent'
@chris-allan
chris-allan / lock_files_in_directory.py
Last active December 11, 2015 22:48
Attempts to perform an exclusive, non-blocking lock on an open file handle to each file in a directory.
#!/usr/bin/env python
import traceback
import fcntl
import sys
import os
try:
d, = sys.argv[1:]
except ValueError:
print 'Usage: %s <directory>' % sys.argv[0]
@technoweenie
technoweenie / gist:5101109
Last active January 7, 2016 16:56
API Existential Crisis

API Existential Crisis

One bit of feedback we've heard from some heavy users of the API is that they want to access user and repository data by ID, and not name.

GET /users/technoweenie
GET /repos/technoweenie/faraday

If you're tracking user or repository data, using a URL with a unique and unchanging ID means the application won't break if the user or repository is