Skip to content

Instantly share code, notes, and snippets.

View gresrun's full-sized avatar

Greg Haines gresrun

  • YouTube
  • San Francisco, CA
View GitHub Profile

Keybase proof

I hereby claim:

  • I am gresrun on github.
  • I am gresrun (https://keybase.io/gresrun) on keybase.
  • I have a public key whose fingerprint is 585E 9622 1E3D B929 8F20 2187 44E3 BD67 7E77 92A8

To claim this, I am signing this object:

@gresrun
gresrun / MultiPerfTest.java
Last active January 13, 2021 18:15
Simple Micro-benchmark to Test Jesque Job Throughput
package net.greghaines.jesque.perftest;
import static net.greghaines.jesque.utils.JesqueUtils.entry;
import static net.greghaines.jesque.utils.JesqueUtils.map;
import static net.greghaines.jesque.worker.WorkerEvent.JOB_SUCCESS;
import static net.greghaines.jesque.worker.WorkerEvent.WORKER_START;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Callable;
public class GoNumSquares {
private static final int BOARD_SIZE = 19;
public static void main(final String... args) {
int squareSum = 0;
for (int i = BOARD_SIZE; i > 0; i--) {
final int dim = (BOARD_SIZE - i) + 1;
squareSum += (dim * dim);
}
public class ASCIIDiamond {
public static void main(final String... args) {
printDiamond(Integer.parseInt(args[0]));
}
public static void printDiamond(final int size) {
if (size % 2 == 0) {
throw new IllegalArgumentException("Size must be an odd number");
}
final int halfSize = (size / 2);
package net.greghaines.jesque;
import static net.greghaines.jesque.utils.JesqueUtils.entry;
import static net.greghaines.jesque.utils.JesqueUtils.map;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicBoolean;
import net.greghaines.jesque.worker.Worker;
import net.greghaines.jesque.worker.WorkerEvent;
@gresrun
gresrun / redisBitSetTests.java
Created May 23, 2012 03:41 — forked from gmuller/redisBitSetTests.java
An attempt to understand byte and bit ordering in redis bitsets
import java.util.Arrays;
import java.util.BitSet;
import redis.clients.jedis.Jedis;
public class SieveOfEratosthenes {
/**
* @param args
*/
function isPrime(n) {
if (n<2) return false;
if (n==2) return true;
for (var i=2; i<(n/2); i++) { if (n%i==0) return false; }
return true;
}
@gresrun
gresrun / gist:1425763
Created December 3, 2011 02:14
LLVM 3.0 Fails to Install - Related to OCAML???
$ brew update
Already up-to-date.
$ brew doctor
We couldn't detect gcc 4.2.x. Some formulae require this compiler.
NOTE: Versions of XCode newer than 4.2 don't include gcc 4.2.x.
/Library/Frameworks/Mono.framework detected
This can be picked up by Cmake's build system and likely cause the
build to fail, finding improper header files for libpng for instance.
@gresrun
gresrun / GTK+_v2.24.4_Fail.txt
Created April 5, 2011 18:53
GTK+ 2.24.4 Fails to Install
greg@macgreg:~ $ brew missing
greg@macgreg:~ $ brew doctor
Your OS X is ripe for brewing.
Any troubles you may be experiencing are likely purely psychosomatic.
greg@macgreg:~ $ brew install -v gtk+
==> Downloading http://ftp.gnome.org/pub/gnome/sources/gtk+/2.24/gtk+-2.24.4.tar.bz2
File already downloaded and cached to /Users/greg/Library/Caches/Homebrew
/usr/bin/tar xf /Users/greg/Library/Caches/Homebrew/gtk+-2.24.4.tar.bz2
==> ./configure --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/gtk+/2.24.4 --disable-glibtest
./configure --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/gtk+/2.24.4 --disable-glibtest
@gresrun
gresrun / gist:826165
Created February 14, 2011 17:01
GnuTLS 2.10.4 Fails to Install
greg@macgreg:~ $ brew info gnutls
gnutls 2.10.4
http://www.gnu.org/software/gnutls/gnutls.html
Depends on: pkg-config, libgcrypt, libtasn1
/usr/local/Cellar/gnutls/2.10.2 (617 files, 7.1M)
http://github.com/mxcl/homebrew/commits/master/Library/Formula/gnutls.rb
greg@macgreg:~ $ brew install -v gnutls
==> Build Environment
CC: /usr/bin/cc => /usr/bin/gcc-4.2
CXX: /usr/bin/c++ => /usr/bin/c++-4.2