Skip to content

Instantly share code, notes, and snippets.

View pthorin's full-sized avatar

Peter Thorin pthorin

View GitHub Profile
import $ivy.`com.softwaremill.retry::retry:0.3.3`
import scala.concurrent.{Await, ExecutionContext, Future}
import scala.concurrent.duration._
import scala.util.control.NonFatal
implicit val ec: scala.concurrent.ExecutionContext = scala.concurrent.ExecutionContext.global
val defaultRetryable = retry.Success[Int](_ == 1)
val retries = 10
val r = scala.util.Random
set laststatus=2
set background=dark
set nocompatible
set ic hls is
set tabstop=2
set shiftwidth=2
set expandtab
set autoindent
set wrap
set textwidth=72
@pthorin
pthorin / firstrun.sh
Last active October 3, 2018 08:58
Set up new server
install_az() {
AZ_REPO=$(lsb_release -cs)
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | \
sudo tee /etc/apt/sources.list.d/azure-cli.list
curl -L https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install apt-transport-https azure-cli
}
install_docker() {
@pthorin
pthorin / sns-temp-alert.py
Last active August 29, 2017 06:49
Small script using the Sense HAT (https://www.raspberrypi.org/products/sense-hat/) on a raspberry pi to measure temperature. If the temperature reaches THRESHOLD, send an AWS SNS publish to alert any interested parties.
import boto3
from sense_hat import SenseHat
THRESHOLD=25.0
sense = SenseHat()
humtemp = sense.get_temperature_from_humidity()
presstemp = sense.get_temperature_from_pressure()
avgtemp = (humtemp + presstemp) / 2

Keybase proof

I hereby claim:

  • I am pthorin on github.
  • I am pthorin (https://keybase.io/pthorin) on keybase.
  • I have a public key ASAD0vfH81rIlC3IvjAh95_E3YEIRj3ZbUpTQZaK9qZ86wo

To claim this, I am signing this object: