Skip to content

Instantly share code, notes, and snippets.

View dtanner's full-sized avatar

Dan Tanner dtanner

  • Target
  • Minneapolis MN US
View GitHub Profile
@dtanner
dtanner / osx-10.9-setup.md
Last active March 20, 2016 18:15 — forked from kevinelliott/osx-10.9-setup.md
Clean Install – Mac OS X 10.9 Mavericks

Install Homebrew / Cask

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
brew install caskroom/cask/brew-cask

todo - replace this with brewfile

Install common applications via Homebrew

@dtanner
dtanner / LocalAndZonedDates.groovy
Last active April 12, 2016 22:40
LocalAndZonedDates
import java.time.LocalDate
import java.time.ZonedDateTime
import java.time.ZoneId
import java.time.format.DateTimeFormatter
import java.time.temporal.TemporalAdjusters
// If you have a date without time information, use a LocalDate. e.g. someone's birthday
LocalDate localDate = new LocalDate(2016, 4, 12)
println localDate.toString() // 2016-04-12
@dtanner
dtanner / DateManipulation.groovy
Created April 12, 2016 22:41
Example showing some java.time date manipulation
import java.time.LocalDate
import java.time.temporal.TemporalAdjusters
LocalDate localDate = LocalDate.now()
println localDate // 2016-04-12
println localDate.plusMonths(1).withDayOfMonth(1) // 2016-05-01
println localDate.minusMonths(1).with(TemporalAdjusters.lastDayOfMonth()) // 2016-03-31
@dtanner
dtanner / ratpack-config-usage.groovy
Created April 18, 2016 18:21
Example of bad vs good ratpack configuration usage
// a config class with a default value
class LogConfig {
boolean logRequestBody = false
}
// in ratpack, the LogConfig is bound with a prefix of `/logging`
Ratpack.groovy {
bindings {
bindInstance(serverConfig.get('/logging', LogConfig))
}
#include <stdio.h>
#include <math.h>
#include <string.h>
#define NUMCARDS 9
#define PRODUCTION 1 /** 0=debug-mode | 1=production mode **/
int getCards(int *);
void displayCards(int *, int);
int getSuit(int codedNumber);
import java.lang.Math.ceil
import java.lang.Math.pow
import kotlin.math.log2
fun main() {
println("\n Welcome to Up-To-9-Cards Game!")
println("\n================================\n")
displayCards(getCards())
println("\n\nDone!\n")
from __future__ import print_function
from math import ceil, log
print("\n Welcome to Up-To-9-Cards Game!")
print("\n================================\n")
def get_cards():
valid_count = 0
@dtanner
dtanner / worker.js
Last active December 18, 2020 15:03
MORC Trail Conditions Cloudflare Reformatter
/*
The https://trails.morcmtb.org/ site has way too much crap that I don't care about.
I just want to quickly see what trails are open.
This is a cloudflare worker that hits the trails API and builds a concise HTML view of the conditions.
It could just be statically hosted javascript, but this was also an excuse to try out workers.
*/
addEventListener("fetch", event => {
return event.respondWith(handleRequest())
})
@dtanner
dtanner / Arduino Debug Build
Created November 3, 2020 23:45
Log output of a working Arduino build with debug compile and upload flags
/Applications/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/dan/Library/Arduino15/packages -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/dan/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/dan/Documents/Arduino/libraries -fqbn=adafruit:nrf52:feather52832:softdevice=s132v6,debug=l0 -vid-pid=0000_0000 -ide-version=10813 -build-path /var/folders/sc/42wc3xvs0jj_vp49xs3rvd8d5hhbjh/T/arduino_build_612855 -warnings=none -build-cache /var/folders/sc/42wc3xvs0jj_vp49xs3rvd8d5hhbjh/T/arduino_cache_42512 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.nrfjprog.path=/Users/dan/Library/Arduino15/packages/adafruit/tools/nrfjprog/9.4.0 -prefs=runtime.tools.nrfjprog-9.4.0.path=/Users/dan/Library/Arduino15/packages/adafruit/tools/nrfjprog/9.4.0 -prefs=runtime
@dtanner
dtanner / kafka-cert-options.md
Last active September 15, 2023 16:33
kafka certificate options

Does this remind anyone else of the Emo Philips Northern Conservative Baptist Great Lakes Region Council of 1912 joke?

Format Base64 Encoded Java Client Compatible Kcat Compatible Benthos Compatible YAML Config Compatible
JKS File
PKCS12 File
PKCS8 PEM String
PKCS8 PEM Unencrypted File
PKCS1 Encrypted PEM File
PKCS8 Encrypted PEM File (MD5 DES-CBC)