Skip to content

Instantly share code, notes, and snippets.

View geraintwhite's full-sized avatar
:octocat:

Geraint White geraintwhite

:octocat:
View GitHub Profile
@geraintwhite
geraintwhite / config.json
Last active March 27, 2018 08:44
Filter Strava Activities
{
"strava": {
"client_id": "your_client_id",
"client_secret": "your_client_secret",
"access_token": "your_access_token",
"redirect_uri": "http://localhost:3000/auth"
}
}
@geraintwhite
geraintwhite / file-url.sh
Last active November 26, 2015 11:15
Get ChromeOS file:// URL for files in crouton.
function file-url {
echo "file:///home/chronos/user$(echo $([ "$1" ] && readlink -e "$1" || pwd -P) | sed "s@$HOME@@")"
}
@geraintwhite
geraintwhite / ArgParse.java
Created November 4, 2015 22:00
Primitive argument parsing for Java
import java.util.ArrayList;
public class ArgParse {
public static class Option {
public String flag, opt;
public Option(String flag) {
this(flag, null);
}
@geraintwhite
geraintwhite / drawarc.c
Last active September 7, 2015 09:24 — forked from distantcam/drawarc.c
Pebble helper functions
/*
Copyright 2013 Cameron MacFarland
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@geraintwhite
geraintwhite / mod.mz
Created June 4, 2015 08:47
Modulus calculator maze module for use with https://github.com/olls/maze-interpreter-v2
## ## () ## ^^ ## ## ## ##
## H1 C2 S1 <> S2 H2 DN ##
## %U <> %D *2 %L IZ .. ##
## ## ## .. ## DN *3 ## ##
## ## ## %R C1 IZ () ## ##
## ## ## ## >> *1
## () *3 *1 %L ()
// Set divisor and dividend
@geraintwhite
geraintwhite / index.html
Last active August 29, 2015 14:21
Pomodro tomato timer - Bash and JS versions
<!doctype html>
<html>
<head>
<title>Tomato Timer</title>
<script src="tomato.js"></script>
</head>
<body>
<button id="start">Start Timer</button>
<button id="stop">Stop Timer</button>
import sys
def fibo(n):
return n if n < 2 else fibo(n-1) + fibo(n-2)
if __name__ == '__main__':
print(fibo(int(sys.argv[1])))
import sys
import hashlib
try:
check = sys.argv[1]
except IndexError:
check = None
@geraintwhite
geraintwhite / gist:c7834873bcc31a311b8a
Created March 24, 2015 16:07
ipv4 and ipv6 regex
var ipv4 = /^((1?\d?\d|2([0-4]\d|5[0-5]))(\.|$)){4}$/;
var ipv6 = /^(([0-9a-f]{1,4})(:|$)){8}$/i;
@geraintwhite
geraintwhite / nbinput.py
Created January 7, 2015 09:35
NonBlockingInput module for Python
"""
Most of this code came from this page:
http://code.activestate.com/recipes/134892/#c5
"""
import sys
import select
UP, DOWN, RIGHT, LEFT = 'A', 'B', 'C', 'D'