Skip to content

Instantly share code, notes, and snippets.

View dinomite's full-sized avatar

Drew Stephens dinomite

View GitHub Profile
package com.fasterxml.jackson.module.kotlin.test.github.failing
import com.fasterxml.jackson.databind.type.TypeFactory
import com.fasterxml.jackson.module.kotlin.KotlinModule
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
import com.fasterxml.jackson.module.kotlin.jsonMapper
import com.fasterxml.jackson.module.kotlin.readValue
import org.junit.Test
import kotlin.test.assertEquals
@dinomite
dinomite / lxc-backup.sh
Last active May 22, 2021 21:20
Simple script to backup LXC containers
#!/usr/bin/env bash
set -ex
BACKUP_DIR=/path/to/where/backups/should/live
HOSTS=($(lxc list -c n --format csv))
for HOST in "${HOSTS[@]}"
do
BACKUP_NAME=${HOST}-$(date +"%Y-%m-%d")
@dinomite
dinomite / Location.kt
Last active March 12, 2019 14:50
Testing data class serialization
import java.time.Instant
data class Location(@JsonProperty val userId: Int,
@JsonProperty val geohash: String,
@JsonProperty val createdAt: Instant,
@JsonProperty val updatedAt: Instant?)
@dinomite
dinomite / Location.kt
Created March 12, 2019 14:47
Testing data classes in Kotlin
import java.time.Instant
data class Location(@JsonProperty val userId: Int,
@JsonProperty val geohash: String,
@JsonProperty val createdAt: Instant,
@JsonProperty val updatedAt: Instant?)
/**
* Not thread safe due to asJson() indentation switching, but good enough for testing
*/
@NotThreadSafe
@SuppressFBWarnings(value = ["ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"],
justification = "Findbugs doesn't understand Kotlin init")
object Json {
val objectMapper: ObjectMapper = ObjectMapper()
init {
#cloud-config
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDaqc90pQAmovrv7+48uBwS9HZwMCBwrqCadf4uKD7yMJY8r+mJ0zSDpqtUHeIKaB13jkTqOJxirVm1o3I1GNgt2EvZ2JSNlQci/D/j0ixlzS1mVpt+OzDk2e7xKe5KoZEbODLUbEYxDh+E9aZfAiDUoK6eInODdVD5sT59pJfljH4YqPkHM9VZtuBcuOGluzFwSkn2OmsQFL9+zAqNFLNt/kF6sP0HVRnZ9+LF/e9ut4rwD5/wobkWAAvKxOT/UVf3QqPiebDk4XkVVqhVRil0Y3WKWoJP/jwLJTrmVWJflgFOxNrgVSHY03Gj80wjAqfDs5cEvGzEoxdYnjIQAA6L dinomite@Caracalla
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDgNqNygJ1Koh1sGGXFCuTTLdxPrPIf9Zp2vDk0ptX8JTX57FQxmP7NzR1kDOqO7ZBQkpWfo40ehsHir1BOo5knTeiuqNbpAWS/ipN/JfjVSYE18G6I14/AMAQM5EpPuWwibGO9Q4e7P7aSnuGFvZPzAD1tyyZPQdvy7LrRlrfwvRguW7tH9934RxjQghwWn2L9sYzjhJV1jKM3QFQ0vDNAOYHD+etn5LU+MqIivrCoK9W2frh4ef8ZMLmGQII5C0ClBnVHuVSZWNbwfPJHpaIWXxW0CuTLIEYh6LLjIq7ZSuq13usBTW+j/69X1EL7e/4BgeqX1e6xvkaYCIvtLtueKV+MqYOpv8yi70xATey7HmUExqvHygcs6pKgcLV7y+JVnceu+3ipaFcpuujFePKmGXmGuYbM4zh4mqrnS37lZWMZFve7r9IYjryTdLpkFGL4ax0t9wF9d+T+ZOX6w8B5+JaP1Fah143Xci1uoSh0e65sX1BV1ALNPON45oJkebMHU0pbAnJmi7bBkDq1FZ4EL1joY

Keybase proof

I hereby claim:

  • I am dinomite on github.
  • I am dinomite (https://keybase.io/dinomite) on keybase.
  • I have a public key whose fingerprint is AD54 E78E BBF8 1792 430A D86E 2F11 EEF0 935F CCA5

To claim this, I am signing this object:

@dinomite
dinomite / scrape.rb
Created October 12, 2015 20:16
495/95 express lanes pricing scraper
#!/usr/bin/env ruby
require 'open-uri'
require 'json'
direction = 'Southbound';
origin = '180SO';
destination = '220SD';
date = '10/09/2015';
@curl_cmd = "curl 'https://www.expresslanes.com/historic-rate-data' -H 'Cookie: data=%7B%7D; digest=b9a6341bf276298b85e14530344aeb95a29b39bb; expire=1445866842; __utmt=1; __utma=269898021.1470859880.1444574061.1444574061.1444657244.2; __utmb=269898021.1.10.1444657244; __utmc=269898021; __utmz=269898021.1444574061.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)' -H 'Origin: https://www.expresslanes.com' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer: https://www.expresslanes.com/historic-rates' -H 'X-curl_cmded-With: XMLHttpcurl_cmd' -H 'Connection: keep-alive' --data
trajan:~$ brew install pdf2svg
==> Downloading http://www.cityinthesky.co.uk/_media/opensource/pdf2svg-0.2.1.tar.gz
File already downloaded and cached to /Users/drew/Library/Caches/Homebrew
==> ./configure --prefix=/usr/local/Cellar/pdf2svg/0.2.1 --disable-debug --disable-dependency-tracking
==> make install
/usr/bin/cc -DPACKAGE_NAME=\"pdf2svg\" -DPACKAGE_TARNAME=\"pdf2svg\" -DPACKAGE_VERSION=\"0.2.1\" -DPACKAGE_STRING=\"pdf2svg\ 0.2.1\" -DPACKAGE_BUGREPORT=\"David\ Barton\ \<davebarton@cityinthesky.co.uk\>\" -DPACKAGE=\"pdf2svg\" -DVERSION=\"0.2.1\" -I. -I/usr/X11R6/include -I/usr/local/Cellar/pixman/0.20.2/include/pixman-1 -I/usr/X11/include/cairo -I/usr/X11/include/freetype2 -I/usr/X11/include -I/usr/X11/include/libpng12 -D_REENTRANT -I/usr/local/Cellar/gtk+/2.24.4/include/gtk-2.0 -I/usr/local/Cellar/gtk+/2.24.4/lib/gtk-2.0/include -I/usr/local/Cellar/atk/2.0.0/include/atk-1.0 -I/usr/local/Cellar/gdk-pixbuf/2.22.1/include/gdk-pixbuf-2.0 -I/usr/local/Cellar/pango/1.28.4/include/pango-1.0 -I/usr/local/C
@dinomite
dinomite / Trajan Homebrew setup
Created April 12, 2011 14:11
brew --config, brew doctor, and brew missing output from Trajan
trajan:~$ brew --config
HOMEBREW_VERSION: 0.8
HEAD: 72b2570c02cabd8330387a37ee9b3c566a065997
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_LIBRARY_PATH: /usr/local/Library/Homebrew
Hardware: quad-core 64-bit arrandale
OS X: 10.6.7
Kernel Architecture: i386