Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / built.sbt
Created November 24, 2016 05:49
Demonstrate slow riak client shutdown
lazy val root = (project in file(".")).
settings(
organization := "au.net.strategicdata",
name := "riak-slow",
version := "0.1",
scalaVersion := "2.11.8"
)
libraryDependencies += "com.basho.riak" % "riak-client" % "2.1.0"
@TJC
TJC / demo.sh
Created January 5, 2017 01:28
Test Minio resiliency
#!/bin/bash
echo "first file is ok" > first.txt
echo "second file is ok" > second.txt
echo "third file is ok" > third.txt
docker-compose up -d
echo "Waiting for docker compose for 10 seconds"
echo "Note: this demo assumes you've configured mc to have an endpoint called local configured...."
sleep 10
mc mb local/test
mc cp first.txt local/test/
@TJC
TJC / README
Created January 6, 2017 05:04
Test jets3t library again Minio
Download the files below into some directory.
Edit setup_env.sh to point to a Minio server.
source ./setup_env.sh
sbt run
@TJC
TJC / reboot-tplink.go
Created July 18, 2017 06:17
Embarrassingly quick and dirty Go program to reboot a TP-Link TD-8840 ADSL modem.