Skip to content

Instantly share code, notes, and snippets.

View jonasbits's full-sized avatar

Jonas Anton Östman jonasbits

View GitHub Profile
To support clamshell mode on a mac laptop, meaning:
When slepping and external display is connected, wake with usb keyboard or other usb stick.
Magsafe needs to be connected.
sudo nvram boot-args="iog=0x0"
To disable this behavior:
sudo nvram -d boot-args
@jonasbits
jonasbits / synergy.conf
Created February 8, 2014 11:54
mapping Meta+Backspace to mac Cmd+Backspace on http://synergy-foss.org/
section: screens
osx.lan:
halfDuplexCapsLock = false
halfDuplexNumLock = false
halfDuplexScrollLock = false
xtestIsXineramaUnaware = false
switchCorners = none
switchCornerSize = 0
ubuntu:
halfDuplexCapsLock = false
@jonasbits
jonasbits / bitcoin-otc.sh
Created February 9, 2014 00:09
Modified script to get a OTP to verify against http://wiki.bitcoin-otc.com/wiki/GPG_authentication#Linux
#! /bin/bash
wget -U "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/32.0.1700.102 Chrome/32.0.1700.102 Safari/537.36" -q -O - http://bitcoin-otc.com/otps/YOURKEYID | gpg -q --output - --decrypt | xclip -i -selection clipboard
@jonasbits
jonasbits / auto_identify.js
Created February 9, 2014 17:16
Script for CIRC running on Chrome/Chromium based on https://github.com/flackr/circ/tree/master/example_scripts (password does not persist if you uninstall and install this script)
/**********************/
//jslint vars: true // change from block comment to line comment if you want to ignore a jslint option
/*jslint sloppy: true */
/*jslint white: true */
/*jslint indent: 2 */
/*jslint debug: true */
/**********************/
/**********************/
/* make jslint happy */
@jonasbits
jonasbits / make-i18n.sh
Last active August 29, 2015 13:57
mkgoogle.sh - convert blockchain.info json language files # # to this specification http://developer.chrome.com/extensions/i18n # to be used with this tool http://translate.google.com/toolkit # The optional "description" tag provides context to translators # but is not yet included by this script.
#!/bin/bash
########################
#
# mkgoogle.sh - convert blockchain.info json language files
#
# to this specification http://developer.chrome.com/extensions/i18n
# to be used with this tool http://translate.google.com/toolkit
# The optional "description" tag provides context to translators
# but is not yet included by this script.
#
#!/bin/bash
# Uses a PID file to add daemon-like behavior to an arbitrary program.
################################################################################
usage() {
echo "Usage: `basename $0` PROGRAM {start|stop|restart|force-stop|force-restart|status} [PIDFILE|PID]" >&2
echo "Where: PROGRAM is an executable file." >&2
echo " PIDFILE is the file that contains (or will contain) the PID." >&2
echo " PID is a process id to use in place of a PIDFILE." >&2
}
@jonasbits
jonasbits / jspdf-cutout.js
Created April 22, 2014 01:26
My code to use with jsPDF.js - http://mrrio.github.io/jsPDF/
var doc = new jsPDF("p","cm","a4");
//19x27px gradient background image
//doc.addImage(imgData,"JPEG",0.1,0.1,20.8,29.4);
//Data URL Size: 1187 bytes
//Original size: 872 bytes
//doc.setDrawColor(255,0,0); // draw red lines
doc.setLineWidth(0.03);
#!/usr/bin/env python
# Copyright (c) 2013 Alon Swartz <alon@turnkeylinux.org>
#
# This file is part of Fab
#
# Fab is free software; you can redistribute it and/or modify it under the
# terms of the GNU Affero General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option) any
# later version.
import sys
import os
import contextlib
from subprocess import Popen, PIPE
def die(message, error_code=1):
print message
sys.exit(error_code)
@jonasbits
jonasbits / libcoind.conf
Created September 10, 2014 22:51
libcoind settings for --namecoin testnet
#libcoind.conf.namecoin.test
#p2p
port = 18334
#port = 19334 #if running namecoin/qt/d at the same time
rpcport = 18336
#rpcuser not needed?
rpcuser = keepitsecret