Skip to content

Instantly share code, notes, and snippets.

@torkildr
torkildr / .psqlrc
Last active Dec 4, 2018
psqlrc-file to clearly indicate difference between the staging and production postgres cluster instance
View .psqlrc
-- 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 Oct 28, 2015
Simple parametric frame. Should work with both CNC and laser cutting.
View frame.scad
//
// All units in mm
//
//
// frame parameters
//
inner_frame_width = 128.5 * 4;
inner_frame_height = 32.1;
@torkildr
torkildr / MofArchive.ps1
Last active Aug 29, 2015
Create zip-archives of Powershell DSC modules used in a Desired State Configuration MOF file.
View MofArchive.ps1
# 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 ...
# {
View Keybase.md

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:

View altibox-6rd.wanup
#!/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 Jan 28, 2014
Quick hack to make make Philips Hue light bulbs dim down when using Chromecast (or, more specifically, when certain apps are open).
View chromelight.py
#!/usr/bin/env python
import os
import requests
import libxml2
import time
import phue
import daemon
import lockfile
import signal
View gist:886568
>>> str="xxxxxx yyyyyyyyyy zzzzzzz"
>>> "".join(["%-40s" % x for x in str.split()])
'xxxxxx yyyyyyyyyy zzzzzzz '