Skip to content

Instantly share code, notes, and snippets.

Torgeir Thoresen torgeir

Block or report user

Report or block torgeir

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
torgeir / mininal-maven-pom.xml
Last active Sep 12, 2019
A minimal maven pom.xml
View mininal-maven-pom.xml
<project xmlns=""
torgeir /
Created Jan 9, 2016
How to run rsync with password in background from a NAS's ssh
RSYNC_PASSWORD=... nohup rsync -av /DataVolume/Folder/* rsync://rsync@server:873/Folder/ &
torgeir / elmish.js
Last active Jul 19, 2019
A plain js take on @ccorcos elmish
View elmish.js
const declare = function (dispatch, state) {
const view = function () {
if (state.error) {
return <p>Error: { state.error }</p>;
if (state.loading) {
return <p>Clock: Loading..</p>;
torgeir / #1 - Scala macros
Last active Jul 6, 2019
A quick howto on getting started with scala macros (from the scala macros paradise branch, using sbt and sbt gen-idea)
View #1 - Scala macros

Scala macros tutorial, using sbt

The following steps executed in order will;

  • create the project file structure
  • set the sbt version
  • add the gen-idea sbt plugin (if you want to import your project into intellij)
  • create an sbt build, that builds the macros project prior to the macrostest project (so the regex macro is usable in the macrostest project)
  • create the macros project scala file
  • create the macrostest project scala file
View react-scaled-file-upload.js
function resize (file, maxWidth, maxHeight, fn) {
var reader = new FileReader();
reader.onload = function (event) {
var dataUrl =;
var image = new Image();
image.src = dataUrl;
image.onload = function () {
torgeir /
Last active May 1, 2019
Resize home folder partition on ubuntu snappy core on the raspberry pi 2

Note where home is

(RaspberryPi2)root@localhost:~# df -h /home/
Filesystem      Size  Used Avail Use% Mounted on
/dev/mmcblk0p4   1.6G 1.3G   160M  89% /oem
(RaspberryPi2)root@localhost:~# df -h
torgeir / aws-stream-logs-from-cloudwatch-lambda-es--lambda-code.js
Created Aug 4, 2016
AWS stream logs from "cloudwatch -> lambda -> es" node.js lambda-code
View aws-stream-logs-from-cloudwatch-lambda-es--lambda-code.js
// v1.1.2
var https = require('https');
var zlib = require('zlib');
var crypto = require('crypto');
var endpoint = '<aws es endpoint>';
exports.handler = function(input, context) {
// decode input from base64
var zippedInput = new Buffer(, 'base64');
torgeir /
Last active Apr 7, 2019
Connect wireless gopro to wireless router with two network interfaces

Connect wireless gopro to wireless router with two network interfaces

For a wireless router on with two network interfaces, e.g. wlan0 and wlan1, you can expose your gopro's live stream on a port on the router using the following setup.

Connect your machine to wlan0, ssh to your router, and run these iptables rules.

iptables -t nat -I PREROUTING -d -j DNAT --to-destination -p tcp --destination-port 8080
torgeir / gulpfile.js
Last active Apr 2, 2019 — forked from markgoodyear/01-gulpfile.js
Example gulpfile.js
View gulpfile.js
// Load plugins
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
torgeir / compile.cljs
Last active Mar 9, 2019
Using clojurescript to compile clojurescript
View compile.cljs
(ns example.core
(:require [cljs.js :as cjs]
[cljs.analyzer :as ana :include-macros true]
[cljs.reader :as r]
[cljs.pprint :as pprint]))
(let [src "(ns t.math)
(defn increase [n] (inc n))"
You can’t perform that action at this time.