Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am sunny256 on github.
  • I am sunny256 (https://keybase.io/sunny256) on keybase.
  • I have a public key whose fingerprint is A006 05D6 E676 B319 55E2 E77E FB0C BEE8 94A5 06E5

To claim this, I am signing this object:

@oyvholm
oyvholm / pacmd_list-sinks.txt
Created July 27, 2016 20:15
Pulseaudio problem
$ pacmd list-sinks
Welcome to PulseAudio! Use "help" for usage information.
>>> 1 sink(s) available.
* index: 0
name: <auto_null>
driver: <module-null-sink.c>
flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: SUSPENDED
suspend cause: IDLE
priority: 1000
@oyvholm
oyvholm / eight_queens.sql
Last active November 5, 2015 19:29 — forked from adewes/eight_queens.sql
Eight Queens Problem Solved using Common Table Expressions
WITH RECURSIVE
positions(i) as (
VALUES(0)
UNION SELECT ALL
i+1 FROM positions WHERE i < 63
),
solutions(board, n_queens) AS (
SELECT '----------------------------------------------------------------', cast(0 AS bigint)
FROM positions
UNION
@oyvholm
oyvholm / frag32.py
Last active September 10, 2015 09:04 — forked from ryancdotorg/frag32.py
A FAT32 fragmenter, because I am a horrible person.
#!/usr/bin/env python
import random
import struct
import sys
# Most of the Fat32 class was cribbed from https://gist.github.com/jonte/4577833
def ppNum(num):
return "%s (%s)" % (hex(num), num)
@oyvholm
oyvholm / runme
Last active August 29, 2015 14:28
hPutChar error message in git-annex with UTF-8 chars above 7F in filenames
#!/bin/bash
#=======================================================================
# runme
# File ID: 38d0ddc8-49bb-11e5-a06b-fefdb24f8e10
#
# Author: Øyvind A. Holm <sunny@sunbase.org>
# License: GNU General Public License version 2 or later.
#=======================================================================
@oyvholm
oyvholm / mandelbrot.sql
Last active August 29, 2015 14:26 — forked from rupey/mandelbrot.sql
Mandelbrot plot in postgres
WITH RECURSIVE
x(i) AS ( VALUES (0)
UNION ALL SELECT i + 1
FROM x
WHERE i < 101),
Z(Ix, Iy, Cx, Cy, X, Y, I) AS (
SELECT
Ix,
Iy,
X :: FLOAT,
@oyvholm
oyvholm / runme
Last active August 29, 2015 14:20
Strange git-annex behaviour
#!/bin/bash
#=======================================================================
# runme
# File ID: 36b615f8-f051-11e4-a442-fefdb24f8e10
#
# Demonstration of strange behaviour in git-annex, README is deleted
# after a "git annex get" when --file is used together with "git annex
# addurl". It's also unable to check the existence of the file on the
# FTP server, so I have to use --force to drop it. This does not happen
# See docs in http://git-annex.branchable.com/internals/hashing/ and implementation in http://sources.debian.net/src/git-annex/5.20140227/Locations.hs/?hl=408#L408
import hashlib
import struct
def hashdirlower(key):
hasher = hashlib.md5()
hasher.update(key)
digest = hasher.hexdigest()
return "%s/%s/" % (digest[:3], digest[3:6])
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
# create our directories
@oyvholm
oyvholm / t5150-output.txt
Created July 3, 2014 21:34
t5150-request-pull.sh fails under Debian 7.5 when compiling git v2.0.1-472-g6f92e5f
*** t5150-request-pull.sh ***
not ok 1 - setup
#
#
# git init --bare upstream.git &&
# git init --bare downstream.git &&
# git clone upstream.git upstream-private &&
# git clone downstream.git local &&
#
# trash_url="file://$TRASH_DIRECTORY" &&