Skip to content

Instantly share code, notes, and snippets.

View TJC's full-sized avatar

Toby Corkindale TJC

View GitHub Profile
@TJC
TJC / build.sbt
Last active January 20, 2022 00:36
non-working snakeyaml in scala with beanproperty
lazy val root = (project in file(".")).
settings(
name := "items",
version := "0.1",
scalaVersion := "2.11.7"
)
libraryDependencies += "org.yaml" % "snakeyaml" % "1.16"
javacOptions ++= Seq("-source", "1.8", "-target", "1.8", "-Xlint")
@TJC
TJC / Dockerfile
Created October 22, 2015 23:43
Dockerfile for Riak, Riak CS and Stanchion
FROM ubuntu:trusty
MAINTAINER tobyc@strategicdata.com.au
ENV DEBIAN_FRONTEND noninteractive
VOLUME /var/lib/riak
EXPOSE 4369 8080 8087 8098 8099
COPY 99-http-proxy /etc/apt/apt.conf.d/
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y curl
RUN curl -s https://packagecloud.io/install/repositories/basho/riak/script.deb.sh | bash
@TJC
TJC / ozisuzu.tamper.js
Last active August 29, 2015 14:24
OzIsuzu tampermonkey userscript
// ==UserScript==
// @name OzIsuzu tamper
// @namespace http://your.homepage/
// @version 0.1
// @description Tweaks to OzIsuzu forum pages
// @author You
// @match http://www.ozisuzu.com.au/*
// @grant none
// ==/UserScript==
@TJC
TJC / ahd_interpolate.c
Created June 19, 2015 01:27
Standard Bayer AHD demosaicing
/* Taken from https://www.cybercom.net/~dcoffin/dcraw/dcraw.c */
/*
Adaptive Homogeneity-Directed interpolation is based on
the work of Keigo Hirakawa, Thomas Parks, and Paul Lee.
*/
void CLASS ahd_interpolate()
{
int i, j, top, left, row, col, tr, tc, c, d, val, hm[2];
static const int dir[4] = { -1, 1, -TS, TS };
@TJC
TJC / xtrans_interpolate.c
Created June 19, 2015 01:20
Fujifilm X-Trans RAW demosaicing algorithm
/* Taken from https://www.cybercom.net/~dcoffin/dcraw/dcraw.c */
/* Which itself attributes this algorithm to "Frank Markesteijn" */
#define TS 512 /* Tile Size */
#define fcol(row,col) xtrans[(row+6) % 6][(col+6) % 6]
void CLASS xtrans_interpolate (int passes)
{
int c, d, f, g, h, i, v, ng, row, col, top, left, mrow, mcol;
int val, ndir, pass, hm[8], avg[4], color[3][8];
@TJC
TJC / announce.example.service
Created December 1, 2014 23:27
CoreOS service and sidekick
[Unit]
Description=Announce Streuth Service
BindsTo=example.1.service
[Service]
ExecStartPre=/usr/bin/etcdctl set /vulcand/hosts/example.local.net/locations/loc1/path "/.*"
ExecStartPre=/usr/bin/etcdctl set /vulcand/hosts/example.local.net/locations/loc1/upstream example
ExecStart=/bin/sh -c "while true; do etcdctl set /vulcand/upstreams/example/endpoints/ep1 'http://%H:5001' --ttl 60;sleep 45;done"
ExecStop=/usr/bin/etcdctl rm /vulcand/upstreams/example/endpoints/ep1
Restart=always
@TJC
TJC / bulk_convert_flac_to_mp3.pl
Created August 25, 2014 02:02
Bulk conversion script from FLAC albums to MP3 with ID3 tags added
#!/usr/bin/env perl
use 5.12.0;
use warnings;
use IPC::Run qw(run);
use autodie;
=head1 NAME
convert_flac_to_mp3.pl
@TJC
TJC / keybase.md
Created August 4, 2014 01:16
keybase proof

Keybase proof

I hereby claim:

  • I am tjc on github.
  • I am tjc (https://keybase.io/tjc) on keybase.
  • I have a public key whose fingerprint is 928F E178 7459 A9A5 8D6E 853F 1C1E 2A07 021B 8378

To claim this, I am signing this object:

@TJC
TJC / bfr_chevron.go
Last active August 29, 2015 14:03
Quick knock-up of scrolling chevron effect
package main
import "fmt"
import "time"
import "github.com/mgutz/ansi"
const ledsAcross = 12 // rows of display
const ledsDown = 16 // columns of display (was 8)
const ledTotal = 12*16
type Colour struct {
@TJC
TJC / kml_dedupe.scala
Created February 6, 2014 04:47
Dedupe placemarks in KML file
// Run with "scala convert.scala"
import scala.xml.XML
import scala.xml.Node
// Given a node, return a trimmed string containing its coordinates
def toCoords(node: Node): String = node match {
case node if ! (node \ "Point").isEmpty => (node \ "Point" \ "coordinates").text.trim
case node if ! (node \ "LineString").isEmpty => (node \ "LineString" \ "coordinates").text.trim
case node if ! (node \ "Polygon").isEmpty => (node \ "Polygon" \ "outerBoundaryIs" \ "LinearRing" \ "coordinates").text.trim
case _ => println(f"node unknown coords: %s", node \ "name"); "unknown"