Skip to content

Instantly share code, notes, and snippets.

View timgreen's full-sized avatar

Tim Green timgreen

  • Sydney, Australia
View GitHub Profile
#!/bin/bash
# Usage:
# REPO='cli/cli' /bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/timgreen/8e16f5a3549f2e902ecd8fa6813beba0/raw)"
# or
# REPO='cli/cli' /bin/bash -c "$(curl -fsSL https://tinyurl.com/mrx345m6)"
# ENV
# - REPO
@timgreen
timgreen / enable_scala_kernel.sh
Last active September 20, 2020 13:29
Scala in Colab
# Based on https://gist.github.com/shadaj/aaac98b690cfeb0cbd891bfe3ce5725d#file-scala-in-colab-template-ipynb
SCALA_VERSION=2.12.8
ALMOND_VERSION=0.3.0+16-548dc10f-SNAPSHOT
[ -f /usr/local/share/jupyter/kernels/scala/kernel.json ] && exit
curl -Lo coursier https://git.io/coursier-cli
chmod +x coursier
./coursier bootstrap \
@timgreen
timgreen / trace-to-mp4.js
Last active October 16, 2018 10:51 — forked from krisselden/trace-to-mp4.js
Make an mp4 out of a Chrome DevTools trace with screenshots.
#!/usr/bin/env node
// Converts a saved Chrome dev tools recording with Screenshots to mp4
const fs = require('fs');
const path = require('path');
const spawn = require('child_process').spawn;
const FPS = 60;
const MICROSEC_PER_FRAME = Math.round(1000000 / FPS);
if (process.argv.length < 3) {
console.log(`node ${path.relative('.', process.argv[1])} [DevToolsProfile]`);
process.exit(1);

Test Gravizo

![Alt text](https://g.gravizo.com/svg? digraph G { aize ="4,4"; main [shape=box]; main -> parse [weight=8]; parse -> execute; main -> init [style=dotted]; main -> cleanup;

def getPeaks(A):
peaks = [-1] * len(A)
for i in xrange(1, len(A) - 1):
if A[i] > A[i - 1] and A[i] > A[i + 1]:
peaks[i] = 0
return peaks
def getNumPeaks(A):
N = len(A)
peaks = getPeaks(A)
@timgreen
timgreen / arch_kde_init_install.sh
Last active December 15, 2015 02:09
Arch KDE init install
#!/bin/bash
# \curl -L http://goo.gl/mA4qmE
pkgs=(
# X
xorg-server
xorg-server-utils
xorg-xinit
# archiver
@timgreen
timgreen / install_yaourt.sh
Last active December 15, 2015 02:09
Arch yaout install script
#!/bin/bash
# \curl -L http://goo.gl/iS4JAG
sudo pacman -S yajl
curl -O https://aur.archlinux.org/packages/pa/package-query/package-query.tar.gz
tar zxvf package-query.tar.gz
cd package-query
makepkg -si
cd ..
curl -O https://aur.archlinux.org/packages/ya/yaourt/yaourt.tar.gz
@timgreen
timgreen / Imd.scala
Created July 6, 2012 06:35
We are hiring!
// Copyright 2012 i-MD. All rights reserved.
import scala.sys.process._
object ImdEngTeam {
lazy val contact = "echo dEBpLW1kLmNvbQ== | base64 -d"!!
def main(args: Array[String]) {
EngCandidates.filter { c =>
@timgreen
timgreen / dictcn.js
Created April 18, 2009 21:20
Ubiquity feed - dictcn
Cache = function(namespace) {
this.namespace = namespace;
this.store = Application.storage;
};
Cache.prototype = {
_: function(key) {
return this.namespace + '-' + key;
},
has: function(key) {
return this.store.has(this._(key));