Skip to content

Instantly share code, notes, and snippets.

View stig's full-sized avatar
🏠
Working from home

Stig Brautaset stig

🏠
Working from home
View GitHub Profile
@stig
stig / New Mac Setup.org
Last active September 9, 2017 19:37
SETUP of new machine

How I set up a new Mac

Install Apps

First I install some apps. I try to use the AppStore for everything if I can, buth unfortunately that’s not possible. YMMV.

AppStore

@stig
stig / percentiles.sh
Last active February 4, 2022 14:55
Print percentiles for list of data points
#!/bin/sh
# Exit immediately on error
set -e
# set -x
# Create temporary file
FILE=$(mktemp /tmp/$(basename $0).XXXXX) || exit 1
trap "rm -f $FILE" EXIT
@stig
stig / Clojure.plist
Created February 3, 2014 00:17
Clojure language module based on the newlisp package by Seth Dillingham and Pete B. Anonymous.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!--
ABOUT:
Clojure language module based on the newlisp package by
Seth Dillingham <[email protected]>
and Pete B. Anonymous.
@stig
stig / PostgresSpec.scala
Last active September 30, 2021 16:07
Full source file for the PostgresSpec from my Scala/Slick/Pg unit testing blog post: https://www.brautaset.org/articles/2013/scala-slick-postgresql-unit-tests.html
package io.superloopy.test
import scala.slick.driver.PostgresDriver.simple._
import scala.slick.driver.PostgresDriver.SchemaDescription
import scala.slick.jdbc.{ StaticQuery => Q }
import org.scalatest.{ BeforeAndAfterEach, BeforeAndAfterAll, Suite }
import io.superloopy.util.DatabaseProvider
trait PostgresSpec extends Suite with BeforeAndAfterEach with BeforeAndAfterAll with DatabaseProvider {
this: { def ddl: SchemaDescription } =>
@stig
stig / dedupe-media.sh
Last active December 24, 2015 20:39
A script I used to consolidate and de-duplicate lots of pictures and movies from various iPhoto libraries and random folders full of images.
#!/bin/sh
set -e
# set -x
src=$1
dst=$2
find "$src" -type f | while read file ; do
chksum=$(md5 -q "$file")
@stig
stig / Ping.scala
Created October 5, 2013 21:05
(Non-compiling) example for "ToResponseMarshaller application problem ( https://groups.google.com/forum/#!topic/spray-user/05SxKaBDU6s ) thread on spray-user mailing list.
package example
import akka.actor._
import akka.actor.ActorDSL._
import akka.io.IO
import akka.pattern.ask
import akka.util.Timeout
import scala.concurrent.duration._
import spray.can.Http
import spray.http.StatusCodes
@stig
stig / GitBundleVersionHook
Created August 10, 2013 09:11
Short script to set CFBundleShortVersionString from the latest tag + CFBundleVersion from the number of commits on the master branch. It is useful to use with Jenkins, and doesn't require you to update the repository, so you don't pollute your change history with "updated version" commits.
#!/bin/sh
# This script automatically sets the version and short version string of an
# Xcode project from the Git repository containing the project.
#
# To use this script in Xcode 4, add the contents to a "Run Script" build
# phase for your application target.
set -o errexit
set -o nounset
@stig
stig / gist:5722747
Created June 6, 2013 16:10
Find the path/name of a newly created file after some operation has run.
% cd /tmp
% mkdir foo
% touch foo/bar
% touch foo/quux
% find foo > t
% touch foo/qzzaoeu
% (find foo; cat t) | sort | uniq -u
foo/qzzaoeu
@stig
stig / primes.txt
Created January 10, 2013 14:29
List of UK Prime Ministers, originally from The Guardian.
Sir Robert Walpole
Sir Robert Walpole
Sir Robert Walpole
Sir Robert Walpole
Sir Robert Walpole
Sir Robert Walpole
Sir Robert Walpole
Sir Robert Walpole
Sir Robert Walpole
Sir Robert Walpole
@stig
stig / RefreshOnlineDocs.sh
Created September 2, 2010 01:20
What I use to update json-framework's api docs
#!/bin/sh
set -x
DOCSET=$INSTALL_DIR/Docset/html
VERSION=$(agvtool mvers -terse1 | perl -pe 's/(\d\.\d+)(\.\d+)*/$1/')
apidir=$VERSION
latest=api