Skip to content

Instantly share code, notes, and snippets.

View larsbutler's full-sized avatar

Lars Butler larsbutler

  • Amazon Web Services, Inc.
  • Switzerland
View GitHub Profile
@larsbutler
larsbutler / start_celery.sh
Created April 17, 2012 08:11
Starting celeryd for oq-engine-LRT
#!/bin/bash
celeryd > /tmp/celery.log 2>&1 3>&1 &
@larsbutler
larsbutler / kill_celery.sh
Created April 17, 2012 08:13
Killing celeryd processes for oq-engine-LRT
#!/bin/bash
for i in `ps aux | grep [c]eleryd | awk '{print $2}'`; do kill -9 $i; done
@larsbutler
larsbutler / .builderrc
Created July 20, 2012 16:17
oq-engine .pbuilderrc contents
# Codenames for Debian suites according to their alias. Update these when
# needed.
UNSTABLE_CODENAME="sid"
TESTING_CODENAME="wheezy"
STABLE_CODENAME="squeeze"
STABLE_BACKPORTS_SUITE="$STABLE_CODENAME-backports"
# Required to test installation into pbuilder chroot.
PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-gdebi"
@larsbutler
larsbutler / packaging_readme.txt
Created July 20, 2012 16:51
oq-engine deb packaging
oq-engine debian packaging
#######
Preface
#######
The purpose of this document is to share a different approach to debian/ubuntu
packaging of oq-engine.
@larsbutler
larsbutler / Main.java
Created August 22, 2012 12:01 — forked from anonymous/Main.java
Main.java
public class Main {
public static void main(String[] args) {
Thread thread = new Thread(new GameKernel());
thread.run();
}
}
@larsbutler
larsbutler / GameWindow.java
Created August 22, 2012 12:02 — forked from anonymous/GameWindow.java
GameWindow.java
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
public class GameWindow extends JFrame {
private JScrollPane viewer;
private GameCanvas canvas;
public static final Dimension SIZE = new Dimension(800, 600);
@larsbutler
larsbutler / GameCanvas.java
Created August 22, 2012 12:02 — forked from anonymous/GameCanvas.java
GameCanvas.java
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferStrategy;
public class GameCanvas extends Canvas {
private BufferStrategy strategy;
@larsbutler
larsbutler / GameKernel.java
Created August 22, 2012 12:02 — forked from anonymous/GameKernel.java
GameKernel.java
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
public class GameKernel implements Runnable {
public static int playerX = 400;
public static int playerY = 300;
@larsbutler
larsbutler / gist:3499931
Created August 28, 2012 16:24
weighted_quantile
def weighted_quantile(weights, curves, quantile):
"""
:param weights:
Array of weights, 1 for each input curve.
:param curves:
2D array of curve PoEs. Each row represents the PoEs for a single curve
:param quantile:
Quantile value to calculate. Should in the range [0.0, 1.0].
"""
# Each curve needs to be associated with a weight:
@larsbutler
larsbutler / gist:3653157
Created September 6, 2012 08:39
Faster mquantiles function - simplified
def compute_quantile_curve(curves, quantile):
"""
Compute the quantile aggregate of a set of curves. This method is used in
the case where hazard curves are computed using the Monte-Carlo logic tree
sampling approach. In this case, the weights are implicit.
:param curves:
2D array-like collection of hazard curve PoE values. Each element
should be a sequence of PoE `float` values. Example::