Skip to content

Instantly share code, notes, and snippets.

Working from home

Kristofer silverbeak

Working from home
Block or report user

Report or block silverbeak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
silverbeak / Dockerfile
Created Jun 19, 2019
I use this script to create a bunch of fake docker images, so I can test my (upcoming) CLI app for removing them
View Dockerfile
FROM hello-world
silverbeak / itt-to-srt.xslt
Last active Mar 7, 2019
An XSLT transform I use for converting itt-formatted subtitles to srt-formatted subtitles
View itt-to-srt.xslt
<?xml version="1.0"?>
This will convert itt-formatted subtitles to srt-formatted subtitles (or captions, if you prefer that)
Use it like so (using xsltproc in this example, feel free to use whatever engine you like):
# xsltproc itt-to-srt.xslt input_in_itt.itt >
<xsl:stylesheet version="1.0"
silverbeak / rmhost
Created Jan 15, 2019
At work, we keep reinstalling our test servers. I use this script to remove outdated known_host keys
View rmhost
# When the error message says something to the effect of
# Offending ECDSA key in /Users/xxx/.ssh/known_hosts:52
# Use the script like this:
# > rmhost 52
# to remove line 52 from the known_hosts file
# NB! Naturally, make sure to KNOW that the key is ok to be removed. Like the warning says
silverbeak / ReadResource.scala
Created Mar 5, 2018
Read resource file using Scala
View ReadResource.scala
* I do this often enough to merit a Gist, but not often enough to remember by heart. Maybe someone else has the same problem.
* The ".mkstring" part can of course be altered to something else as needed, if you don't want a String
val jsonMsg: String = Source.fromURL(getClass.getResource("/json/test1.json")).mkString
silverbeak / YearDiff.groovy
Last active Dec 30, 2015
There was a question on SO on how to calculate someones current age in years. It's a simple enough operation using Joda-time ( I thought I'd turn my example into a gist, if anyone else is interested. It's easy to turn this into something that would calculate the age in days or months or whatever... Please tell me if…
View YearDiff.groovy
import org.joda.time.DateTime
import org.joda.time.Years
def calculateAgeInYears(int year, int monthOfYear, int dayOfMonth) {
def yob = new DateTime(year, monthOfYear, dayOfMonth, 0, 0).toDateMidnight()
def now =
return Years.yearsBetween(yob, now).getYears()
def years = calculateAgeInYears(1983, 12, 10)
You can’t perform that action at this time.