Skip to content

Instantly share code, notes, and snippets.

@hertzsprung
hertzsprung / check_netcdf.py
Created September 14, 2014 14:27
Check NetCDF installation
from netCDF4 import Dataset
from mpl_toolkits.basemap import Basemap
@hertzsprung
hertzsprung / Makefile
Last active August 29, 2015 14:21
SDL2/cairo cross compiler test with mingw
PKG_CONFIG := pkg-config
#SDL_CONFIG := sdl2-config
SDL_CONFIG := /usr/x86_64-w64-mingw32/bin/sdl2-config
SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
SDL_LDFLAGS := $(shell $(SDL_CONFIG) --libs)
CAIRO_CFLAGS := $(shell $(PKG_CONFIG) cairo --cflags)
CAIRO_LDFLAGS := $(shell $(PKG_CONFIG) cairo --libs)
cairotest: cairotest.c
clang $(SDL_CFLAGS) $(SDL_LDFLAGS) $(CAIRO_CFLAGS) $(CAIRO_LDFLAGS) -o cairotest cairotest.c
@hertzsprung
hertzsprung / msc-computing.md
Created July 29, 2015 10:38
MSc computing notes

Work through an exercise of processing a CSV file containing time series data on amount of sunshine.

Exercise requirements

TODO

On the day

  1. Plan conceptual steps together to create a flowchart on whiteboard
  • how to find and use existing code
@hertzsprung
hertzsprung / Foo.java
Created July 28, 2011 21:32
java.lang.invoke
package foo;
import static java.lang.invoke.MethodHandles.catchException;
import static java.lang.invoke.MethodHandles.publicLookup;
import static java.lang.invoke.MethodType.methodType;
public class Foo {
public void sayHello(String name) throws RuntimeException {
System.out.println("hello " + name);
throw new RuntimeException("boom!");
@hertzsprung
hertzsprung / Java7Lols.java
Created July 28, 2011 21:48
Assorted Java 7 features
package foo;
import static java.util.EnumSet.of;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
@hertzsprung
hertzsprung / AllOfTest.java
Created April 7, 2012 12:39
Test case for Hamcrest AllOf missing mismatch description
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.both;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.lessThan;
import org.junit.Test;
public class AllOfTest {
@Test
public void doesPrintMismatch() {
@hertzsprung
hertzsprung / pom.xml
Created May 5, 2012 17:30
Maven release plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.2.2</version>
<configuration>
<arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
</configuration>
</plugin>
@hertzsprung
hertzsprung / pom.xml
Created May 5, 2012 17:24
Maven source code management information
<scm>
<connection>scm:git:git://github.com/hertzsprung/redis-launcher.git</connection>
<developerConnection>scm:git:git@github.com:hertzsprung/redis-launcher.git</developerConnection>
<url>http://github.com/hertzsprung/redis-launcher</url>
</scm>
@hertzsprung
hertzsprung / pom.xml
Created May 5, 2012 17:35
Maven distribution management
<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus snapshot repository</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<name>Sonatype Nexus release repository</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
@hertzsprung
hertzsprung / pom.xml
Created May 5, 2012 17:38
Maven artifact signing
<profiles>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>