Skip to content

Instantly share code, notes, and snippets.

@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 / 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,
# 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 / README.md
Created February 25, 2014 03:51 — forked from BrianHicks/README.md

Graph taskwarrior tasks with graphviz

Dependencies

Running

graphdeps produces "deps.png" in the working directory. Just graphdeps will graph all tasks. You can change the default behavior by specifying a more specific query.

Hello there! This is a sample post for gist.io, a super-lightweight writing soapbox for hackers.

Now look up. Further. Above the post title. See that grey text with the gist ID?

Now back to me. That grey text is a link! Open that sucker in a new tab to see the source for this post. Also, I'm on a horse.

This is a major heading

If you peek at it with a web inspector, you'll see that it is a second-level heading. You can use first level headings, but they'll look just like the second level ones, and the gods of the HTML5 outlining algorithm will frown upon you.

@oyvholm
oyvholm / svngit.textile
Created August 27, 2012 00:46 — forked from gorenje/svngit.textile
Subversion v. Git - Thinking in patches

Introduction

This post attempts to provide Subversion developers a new perspective on Git and how git is differs from
subversion but not using the usual “git is distributed development” or “git is peer-to-peer versioning
management”, which tend not provide an argument for an existing subversion project to switch to git.

Instead, I will attempt to provide a historical background to the development of the first versioning
tools and how these lead to the development of git. It is more that probably that certain historical events
mentioned here are completely and utterly wrong, this not intended. Corrections and improvements are very
welcome!

@oyvholm
oyvholm / gist:836901
Created February 21, 2011 10:23 — forked from beekhof/gist:836887
# Put this in ~/.gitconfig
# https://git.wiki.kernel.org/index.php/Aliases
[alias]
ci = commit
co = checkout
fp = format-patch
bl = blame --date=short -M
br = !git branch --no-color | grep '*' | sed -e 's/^* //'
who = shortlog -s --