Skip to content

Instantly share code, notes, and snippets.

View Synesso's full-sized avatar

Jem Mawson Synesso

View GitHub Profile
{"id":"0-15mph","source":null,"filter":null}
{"id":"0-15mph-case","source":"edgespeed","filter":["all",["<","mph",15],["in","fc",1,2]]}
{"id":"0-5mph-arterial","source":"edgespeed","filter":["all",["<","mph",13],["==","fc",3]]}
{"id":"10-20mph-arterial","source":"edgespeed","filter":["all",[">=","mph",18],["<","mph",28],["==","fc",3]]}
{"id":"15-35mph","source":null,"filter":null}
{"id":"15-35mph-case","source":"edgespeed","filter":["all",[">=","mph",15],["<","mph",35],["in","fc",1,2]]}
{"id":"35-55mph","source":null,"filter":null}
{"id":"35-55mph-case","source":"edgespeed","filter":["all",[">=","mph",35],["<","mph",55],["in","fc",1,2]]}
{"id":"5-10mph-arterial","source":"edgespeed","filter":["all",[">=","mph",13],["<","mph",18],["==","fc",3]]}
{"id":"admin-2-boundaries","source":"admin","filter":["all",["==","admin_level",2],["==","maritime",0],["==","disputed",0]]}
04c45bc7968d127b26b0d43c6f8a610b948bb9428db9d7fb99eb7a93d8f4680d8b3e4110df8119cf6d9d0ec25d8d0e0c0ee8e37743623ae2af4621d71f5aae6a39
@Synesso
Synesso / gist:61fbdaaf70b1847251d320ce6177680a
Created February 16, 2018 00:04
Quick and dirty tileserver
docker run -it -v /tmp/tilestream/tiles:/data -p 8080:80 klokantech/tileserver-gl
// using json4s-native 3.6.0-M2
"bad json" should {
"not be parsed" >> {
val s = """{"foo":[{"bar":1},{"bar":2}{"bar":3}]}"""
parse(s) must throwAn[Exception]
}
}
/*
@Synesso
Synesso / watchcoins.sh
Last active November 29, 2017 23:44
Watch btcmarkets and alert to slack
#!/usr/bin/env bash
# seed the coins to be watched in a file called .alert_price, with space separated fields CODE LAST_PRICE TRIGGER%
# e.g.
# BTC 13801.31 2.0
# ETH 590.02 2.0
# XRP 0.33 5.0
#
# alerts use icon_emoji's :gain: and :loss: and write to the slack channel with the same name as the coin's code.
#
@Synesso
Synesso / delete_empty_logsets.sh
Created May 26, 2017 02:26
Delete empty LogEntries logsets on OSX
# pip install logentries-lecli
# then configure as per https://blog.logentries.com/2016/07/introduction-to-the-logentries-command-line-interface/
# logsets with logs in them
lecli get logs | jq -r '.logs[].logsets_info[].id' | sort -u > have_logs
# all logset ids
lecli get logsets | jq -r '.logsets[] | .id' | sort > logsets
for ls in $(comm logsets have_logs | grep -v "$(printf '\t')")
@Synesso
Synesso / split_bbox.scala
Created September 2, 2016 00:23
split-bbox-for-regions.json
val gc = Bounds(Point(-28.223163, 153.372282), Point(-27.854310, 153.493241))
def loop(bb: Bounds): List[Bounds] = {
if (Distance(bb.sw, bb.ne).miles > 15) {
val (a,b,c,d) = bb.quadrants
List(a,b,c,d).flatMap(loop)
} else List(bb)
}
def toJson(bb: Bounds): String = {
#!/bin/bash
#Retreived from http://web.archive.org/web/20140625220735/http://360percents.com/posts/command-line-twitter-status-update-for-linux-and-mac/
#Twitter status update bot by http://360percents.com
#Author: Luka Pusic <pusic93@gmail.com>
#REQUIRED PARAMS
username="username"
password="password"
tweet="$*" #must be less than 140 chars
package com.github.synesso.cheryl
object Main extends App {
val possibleAnswers = Set(
May(15), May(16), May(19),
Jun(17), Jun(18),
Jul(14), Jul(16),
Aug(14), Aug(15), Aug(17)
)
{"paymentInstrumentTypes":[{"paymentInstrumentTypeId":3,"description":"American Express Credit Card","name":"Amex"},{"paymentInstrumentTypeId":6,"description":"Internet Banking","name":"POLi"},{"paymentInstrumentTypeId":5,"description":"Bank Account","name":"BankAccount"},{"paymentInstrumentTypeId":2,"description":"MasterCard Credit Card","name":"MasterCard"},{"paymentInstrumentTypeId":1,"description":"Visa Credit Card","name":"Visa"},{"paymentInstrumentTypeId":4,"description":"Diners Credit Card","name":"Diners"}]}