Skip to content

Instantly share code, notes, and snippets.

View torbjornvatn's full-sized avatar
🤷‍♂️

Torbjørn Vatn torbjornvatn

🤷‍♂️
View GitHub Profile

Keybase proof

I hereby claim:

  • I am torbjornvatn on github.
  • I am torbjornvatn (https://keybase.io/torbjornvatn) on keybase.
  • I have a public key ASBBXABVuxtmQ5Xh-p32QByQ1HNDAIsLDrxLUJwRcw1Cbgo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@torbjornvatn
torbjornvatn / README.md
Last active January 10, 2018 08:18
Google DataLab Github Remote

Why?

We here at Unacast are using Google Cloud Datalab quite a bit for data analysis and exploration and think it's a great product.

The Version Control experience is a bit clunky to say the least. Either you'll have to use the bundled Ungit web interface, or you have to ssh and docker your way into the running Docker container to use the git CLI. Either way the you'll have to work against a Google Cloud Source Repository as the remote, while we really want to utilize Github's .ipynb preview functionallity and Pull Request mechanism. Source Repositories do have a Github sync feature, but it only works one way and you have to set it up when you create the repository (which you can't do for datalab repos).

So this is an attempt of setting up some git tricks to make this workflow a bit smoother and setting up Github as the remote for the project.

How?

First of all it's a bit of a pain to docker exec into the container from the

@torbjornvatn
torbjornvatn / core.cljs
Last active August 28, 2017 09:12
core.clj for my Trigger Dataflow pipelines with Cloud Functions written in Clojurescript blog post
(ns pipeline-example.core
(:require [cljs.pprint :as pp]
[clojure.string :as string]))
(def circular-json (js/require "circular-json-es6"))
(def spawn (.-spawn (js/require "node-jre")))
(def __dirname (js* "__dirname"))
(defn args
@torbjornvatn
torbjornvatn / README.md
Last active August 14, 2017 07:40
Parsing JSON with optional and mutual exclusive fields in Golang

Motivation

I have this Go application that uploads files to either a S3 bucket or a SFTP server (and potentially Google Cloud Storage buckets in the future) and the location of these are stored in JSON config files. I wanted to

@torbjornvatn
torbjornvatn / project.clj
Last active August 28, 2017 09:09
project.clj for my Trigger Dataflow pipelines with Cloud Functions written in Clojurescript blog post
(defproject pipeline-example "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.8.0"]
[datasplash "0.4.1"]
[org.clojure/clojurescript "1.9.456"]]
:plugins [[lein-cljsbuild "1.1.5"]
[macchiato/lein-npm "0.6.2"]] ;; Using a fork to get a generated package.json
:profiles {:uberjar {:main pipeline-example.core
:source-paths ["src-clj"]
:target-path "target/pipeline-example"
@torbjornvatn
torbjornvatn / .gitignore
Last active January 6, 2017 09:02
Images for Slack 101 post
.DS_Store
@torbjornvatn
torbjornvatn / streaming_word_extract.clj
Last active July 24, 2019 19:24
Streaming word extract
(ns streaming-word-extract
(:require
[pubsub-utils] ;; This is our local pubsub-utils namespace
[datasplash
[api :as ds]
[bq :as bq]
[pubsub :as ps]]
[clojure.string :as string])
(:import
@torbjornvatn
torbjornvatn / commands.scala
Last active May 20, 2016 11:53
sbt-cli-example
import Ansi._
import sbt.complete.DefaultParsers._
import sbt.complete.Parser
// A ADT representing the different commands this program understands
// The run() method is call whenever a command is encountered in the main loop
// in the Cli trait
sealed trait CliCommand {
def run(): Unit
}
@torbjornvatn
torbjornvatn / app.js
Last active February 2, 2016 19:18
Unacaster examples
#!/usr/bin/env node
var WebSocketClient = require('websocket').client;
var Player = require('play-sound')(opts = {"player": "omxplayer"})
var winston = require('winston');
winston.add(winston.transports.File, { filename: 'unacaster.log' });
var client = new WebSocketClient();
var playing = false;
var reconnectInterval = 1 * 1000 * 60;