Skip to content

Instantly share code, notes, and snippets.

View tko's full-sized avatar

Tommi Komulainen tko

  • http://goscoutgo.com/
  • X @tko
View GitHub Profile
@tko
tko / hello.c
Created July 5, 2018 17:58
meson coverage test
#include <stdio.h>
int main(int argc, char **argv) {
printf("Hello world!\n");
return 0;
}
@tko
tko / brew-cask-outdated
Created September 7, 2016 20:08
list installed casks that have newer versions available https://caskroom.github.io/
#!/usr/bin/env bash
set -e
contains() {
local needle=$1
for x in "${@:2}"; do
[[ "$x" == "$needle" ]] && return 0
done
return 1
}
@tko
tko / Dockerfile
Last active September 7, 2016 19:20
vagrant with docker backend
FROM ubuntu:12.04
# https://www.vagrantup.com/docs/boxes/base.html
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
bash \
openssh-server \
sudo \
&& rm -rf /var/lib/apt/lists/* \
@tko
tko / gzipmulti.py
Created November 10, 2015 20:22
read concatenated gzip streams individually
#!/usr/bin/env python
# Copyright 2015 Tommi Komulainen
# Licensed under the Simplified BSD License
"""read concatenated gzip streams individually
A gzip file can contain multiple compressed parts concatenated together.
As most file formats can not simply be concatenated together this module
lets you read each part individually.
Example:
@tko
tko / modify-ami.py
Created July 1, 2015 10:59
Automate customization of an existing AMI
#!/bin/env python
#
# Automate customization of an existing AMI. Intended for producing jenkins
# slaves for multiple platforms in easily reproducable / customizable fashion.
#
# Runs following steps unattended:
# 1) create a new instance (m1.small) from given AMI
# 2) wait for it to get started and SSH accessible
# 3) run a set of commands on the instance
# 4) stop the instance (and wait for it to stop)
@tko
tko / r.rb
Created June 27, 2015 22:45
puppet provider for R packages
# coding: utf-8
# puppet/modules/r/lib/puppet/provider/package/r.rb
#
# puppet provider for R packages that should handle local files, puppet files, and CRAN repositories
#
# Usage:
# package { "ggplot2": provider => r, source => "cran+http://cran-mirror.cs.uu.nl" }
# package { "ggplot2": provider => r, source => "puppet:///modules/whatever/ggplot2_1.0.0.tar.gz" }
# package { "ggplot2": provider => r, source => ["puppet:///modules/whatever/ggplot2_${my_nonexistent_version}.tar.gz",
# "cran+http://cran-mirror.cs.uu.nl",