Skip to content

Instantly share code, notes, and snippets.

View wulfgarpro's full-sized avatar
🤘

James Fraser wulfgarpro

🤘
View GitHub Profile
@wulfgarpro
wulfgarpro / CMakeLists.txt
Last active July 14, 2016 07:38
Example cmake file with gtest
cmake_minimum_required (VERSION 2.6)
option (test "Build all tests." ON)
project (Tutorial)
set (CMAKE_CXX_FLAGS "-g -Wall")
#add_subdirectory (src/tutorial)
# The version number.
@wulfgarpro
wulfgarpro / generate.py
Last active February 21, 2016 04:59
cgi script in python to generate kml LineString with LineStyle
#!/usr/bin/python
import random
lat_a = random.randrange(35, 40)
lon_a = random.randrange(-120, -112)
lat_b = random.randrange(35, 40)
lon_b = random.randrange(-120, -112)
kml = (
@wulfgarpro
wulfgarpro / cgi-kml.kml
Last active February 21, 2016 05:00
Example kml to load cgi script using NetworkLink with flyToView/refreshInterval enabled
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Folder>
<name>Network Links</name>
<visibility>0</visibility>
<open>0</open>
<description>Network link example 1</description>
<NetworkLink>
<name>Random Placemark</name>
<visibility>0</visibility>
@wulfgarpro
wulfgarpro / docker_rm_all.sh
Created December 1, 2015 05:20
Single line to remove all containers from docker
docker ps -a | awk '{ print $1 }' | xargs -I {} docker rm -f {}
@wulfgarpro
wulfgarpro / gist:5889382
Last active December 19, 2015 03:19
Board generation code
private def setupBoard() {
// generate board based on observed patterns (see readme)
(1..4).each( {
if(it == 1) {
(minX..maxX).each( {
if(it == minX) {
board.put("${it},${minY}", ["NORTH":true,"SOUTH":false,"EAST":true,"WEST":false])
} else if(it == maxX) {
board.put("${it},${minY}", ["NORTH":true,"SOUTH":false,"EAST":false,"WEST":true])
} else
@wulfgarpro
wulfgarpro / gist:4257841
Created December 11, 2012 11:11
Javascript prototypes, constructors, and inheritence
​var Person = function(name) {
if(name) this.name = name;
};
Person.prototype.name = 'No name';
Person.prototype.setName = function(name) {
this.name = name;
};
Person.prototype.getName = function() {
return this.name;
};
@wulfgarpro
wulfgarpro / gist:4202874
Created December 4, 2012 11:28
Shell script to route my wlan0 via eth0
#!/bin/bash
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
@wulfgarpro
wulfgarpro / gist:3938777
Created October 23, 2012 13:37
output from smx 4.2
karaf@root> list | grep -i spring
ID State Blueprint Spring Level Name
[ 78] [Active ] [ ] [ ] [ 60] activemq-spring (5.5.1)
[ 79] [Active ] [ ] [ ] [ 60] Apache XBean :: Spring (3.
7)
[ 94] [Active ] [ ] [ ] [ 50] camel-spring (2.8.5)
karaf@root> list | grep -i cxf
[ 150] [Active ] [Created ] [ ] [ 50] camel-cxf (2.8.5)
@wulfgarpro
wulfgarpro / gist:3938644
Created October 23, 2012 13:08
pom.xml that works for postgres osgi'fication
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pro.wulfgar.net.on.users</groupId>
<artifactId>postgres-jdbc</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
@wulfgarpro
wulfgarpro / gist:3726314
Created September 15, 2012 04:07
Split with limit
The string "boo:and:foo", for example, yields the following results with these parameters:
Regex Limit Result
o 5 { "b", "", ":and:f", "", "" }