Skip to content

Instantly share code, notes, and snippets.

View torkildr's full-sized avatar

Torkild Retvedt torkildr

View GitHub Profile
@torkildr
torkildr / .psqlrc
Last active December 4, 2018 07:52
psqlrc-file to clearly indicate difference between the staging and production postgres cluster instance
-- psqlrc to clearly indicate difference between the staging and production postgres cluster instance
SHOW cluster_name
\gset
SELECT
:'cluster_name' LIKE '%production%' AS is_production,
:'cluster_name' LIKE '%staging%' AS is_staging
\gset
@torkildr
torkildr / frame.scad
Created October 28, 2015 06:57
Simple parametric frame. Should work with both CNC and laser cutting.
//
// All units in mm
//
//
// frame parameters
//
inner_frame_width = 128.5 * 4;
inner_frame_height = 32.1;
@torkildr
torkildr / MofArchive.ps1
Last active August 29, 2015 14:27
Create zip-archives of Powershell DSC modules used in a Desired State Configuration MOF file.
# Author: Torkild Retvedt
# License: The MIT License (MIT)
#
# Creates multiple zip-files from the modules of in a given DSC MOF-file.
# This script should be run on the same machine that generated the MOF-file.
#
# Example: A DSC MOF-file with content like:
#
# instance of ...
# {
@torkildr
torkildr / Keybase.md
Created June 10, 2015 11:28
Keybase Proof

Keybase proof

I hereby claim:

  • I am torkildr on github.
  • I am torkildr (https://keybase.io/torkildr) on keybase.
  • I have a public key whose fingerprint is 0964 5D1A 2F95 71BF 3129 1907 6A61 BDA4 5F57 DC03

To claim this, I am signing this object:

#!/bin/sh
# Place it in /jffs/etc/config/altibox-6rd.wanup, and then ln -s /jffs/etc/config/altibox-6rd.ipup to it.
# This script is inredible untested, and is currently used mostly as notes...
# The Altibox 6rd gateway.
REMOTE=213.167.115.92
# Your local IP address.
LOCAL="$(ifconfig eth1 | sed -n '/inet /{s/.*addr://;s/ .*//;p}')"
LOCAL_HEX=$(printf '%02X%02X%02X%02X' $(echo $LOCAL | tr '.' ' ') | awk '{print substr($1,1,
@torkildr
torkildr / chromelight.py
Created January 28, 2014 09:13
Quick hack to make make Philips Hue light bulbs dim down when using Chromecast (or, more specifically, when certain apps are open).
#!/usr/bin/env python
import os
import requests
import libxml2
import time
import phue
import daemon
import lockfile
import signal
>>> str="xxxxxx yyyyyyyyyy zzzzzzz"
>>> "".join(["%-40s" % x for x in str.split()])
'xxxxxx yyyyyyyyyy zzzzzzz '