Skip to content

Instantly share code, notes, and snippets.

View haakenlid's full-sized avatar
🕺

Håken Lid haakenlid

🕺
View GitHub Profile
@haakenlid
haakenlid / numberwang.py
Created January 30, 2016 23:59
numberwang
def numberguess(attempts=3, name=None, number=10):
while not name:
name = input('Hello, what is your name? ')
if attempts == 0:
print('Your three guesses are over, the number I was thinking of was %d.' % number)
return
while True:
guess = input('Well %s please guess a number between 1 and 20 ' % name)
@haakenlid
haakenlid / sp
Created December 6, 2015 13:07 — forked from wandernauta/sp
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/bin/bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#
@haakenlid
haakenlid / haakenlid
Last active October 18, 2015 00:19
Keyboard remapping that makes Norwegian glyphs easier on English keyboard layout.
partial partial alphanumeric_keys
xkb_symbols "basic" {
name[Group1] = "Engelsk og Norsk";
include "us(altgr-intl)"
// My custom changes:
key <AE11> { [ minus, underscore, endash, emdash ] };
key <AD11> { [ bracketleft, braceleft, aring, Aring ] };
key <AC10> { [ semicolon, colon, oslash, Oslash ] };
key <AC11> { [ apostrophe, quotedbl, ae, AE ] };
key <AB08> { [ comma, less, guillemotleft ] };
@haakenlid
haakenlid / make_wordpress.sh
Last active August 29, 2015 14:17
Create and activate new wordpress installations with mysql-database and nginx configuration on Ubuntu.
#! /bin/bash
randpw(){ < /dev/urandom tr -dc A-Za-z0-9 | head -c${1:-16};echo;}
MYSQL_ROOT_PW="your_root_pw_for_mysql_here"
SITE=$1
USER=${SITE/\./_}
DBNAME=$USER
PASSWORD=$(randpw)
@haakenlid
haakenlid / gist:3e839c6ac8ebd4f61757
Last active August 29, 2015 14:11 — forked from robinkraft/gist:4d1807fb8f9c246b2d21
OpenCV for python on Ubuntu
# download opencv first
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y cmake
sudo apt-get install -y libgtk2.0-dev
sudo apt-get install -y pkg-config
sudo apt-get install -y python-numpy python-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev libjasper-dev
@haakenlid
haakenlid / mysite.sublime-project
Last active August 29, 2015 14:04
mysite.sublime-project settings for running django tests
{
"build_systems":[
{
"env":
{
"TEST_SETTINGS_MODULE": "mysite.settings.testing",
"VENV_FOLDER": "/srv/localhost.mysite.com/venv/mysite/"
},
"file_regex": "^ *File \"(...*?)\", line ([0-9]*)",
"name": "app unit tests",