Skip to content

Instantly share code, notes, and snippets.

View steinybot's full-sized avatar

Jason Pickens steinybot

View GitHub Profile

Keybase proof

I hereby claim:

  • I am steinybot on github.
  • I am steinybot (https://keybase.io/steinybot) on keybase.
  • I have a public key ASAF_nkW-0m13F3vFwdFpb9a63hsGAj3nMOoIixpEL_hUAo

To claim this, I am signing this object:

@steinybot
steinybot / CharacterGen.java
Last active August 6, 2019 03:53
junit-quickcheck generator which can generate an efficient generator for arbitrary character classes
package com.example.generator;
import com.pholser.junit.quickcheck.Pair;
import com.pholser.junit.quickcheck.generator.Gen;
import com.pholser.junit.quickcheck.generator.GenerationStatus;
import com.pholser.junit.quickcheck.generator.Generator;
import com.pholser.junit.quickcheck.generator.InRange;
import com.pholser.junit.quickcheck.generator.java.lang.IntegerGenerator;
import com.pholser.junit.quickcheck.random.SourceOfRandomness;
import com.squareup.javapoet.*;
@steinybot
steinybot / analyse-branch-tags.sh
Last active July 22, 2019 00:26
Script to determine if the head of each branch has a tag
#!/usr/bin/env bash
readonly REMOTE="${1:-origin}"
tagged=()
tagged_local=()
untagged=()
while read line; do
IFS=$'\t ' read -r -a parts <<< "${line}"
@steinybot
steinybot / README.md
Created July 15, 2019 07:13
How to Create a macOS Catalina Beta ISO

How to Create a macOS Catalina Beta ISO

Prerequisits

  1. Sign up for the Beta Program https://beta.apple.com/sp/betaprogram.
  2. Create a Time Machine Backup (just in case).

Download the Beta

  1. Cmd + Space -> Software Update.
@steinybot
steinybot / Scratch.java
Created March 28, 2019 05:19
Check if the operating system is 64-bit
import com.sun.jna.Platform;
import com.sun.jna.platform.win32.Kernel32;
import com.sun.jna.platform.win32.Kernel32Util;
import com.sun.jna.platform.win32.WinNT;
import com.sun.jna.ptr.IntByReference;
class Scratch {
public static void main(final String[] args) {
System.out.println("Is 64-bit OS? " + is64BitOS());
@steinybot
steinybot / Bob.txt
Created March 30, 2018 00:58
This is a markdown test
Bob
@steinybot
steinybot / CoproductImplicits.scala
Last active March 7, 2018 04:42
Play Json Reads and Writes for Coproducts
package com.geneious.nucleus.service.util.play.json
import play.api.libs.json._
import shapeless._
trait CoproductFormats {
implicit val cNilReads: Reads[CNil] = Reads(_ => JsError())
implicit val cNilWrites: Writes[CNil] = Writes(_ => JsNull)
@steinybot
steinybot / Entities.scala
Last active February 2, 2018 00:00
Understanding Slick Projections
case class Inner(a: String, b: Int)
case class Outer(a: String, i: Inner)
@steinybot
steinybot / git-inserts-deletes.sh
Last active January 25, 2018 19:58
Git insertions and deletions
git log --shortstat --format="%an" | sed '/^$/d' | awk '
BEGIN { FS = ", " }
{
if (match($1, /^ [0-9]+ files? changed/)) {
split($2, a, " ")
inserts = (a[1] == "")? 0 : a[1]
split($3, b, " ")
deletes = (b[1] == "")? 0 : b[1]
total = (inserts - deletes)
print name " " inserts " " deletes " " total
@steinybot
steinybot / FixingVarianceErrors.scala
Created October 11, 2017 19:50
How to convince the compile that the variance is safe
object FixingVarianceErrors {
trait InvariantThing[T]
trait CovariantThing[+T] {
// Fails to compile with error:
// Error:(12, 9) covariant type T occurs in invariant position in
// type => FixingVarianceErrors.InvariantThing[T] of method thing1
def thing1: InvariantThing[T]