Skip to content

Instantly share code, notes, and snippets.

import numpy as np
import cv2
import os # changed
def inside(r, q):
rx, ry, rw, rh = r
qx, qy, qw, qh = q
return rx > qx and ry > qy and rx + rw < qx + qw and ry + rh < qy + qh
@maikelwever
maikelwever / sailfish_huashan.md
Last active February 11, 2017 15:06
SailfishOS on Xperia SP guide

Running SailfishOS on the Xperia SP

  • Insert default warranty void message here. You warranty is now void :P
  • I have not tested this on locked bootloaders, but since I needed to modify the kernel, I guess that you need an unlocked bootloader.
  • Note this is not an offical SailfishOS build, and the Xperia SP is not the Jolla phone, so please don't report bugs to Jolla.
  • The Sailfish image does not provide recovery, and since the Xperia SP does not have a recovery partition, you need a seperate bootimage with only recovery on it to flash cm/stock/sailfish upgrade
  • The Sailfish image is based on a specific version of Cyanogenmod 11, which you will need to flash first.

You can find a bootimage with only TWRP recovery in it here: https://maikelwever.nl/sailfish/recoveryboot.img

@maikelwever
maikelwever / libvirt-vga-passtrough.rst
Last active January 27, 2017 11:47
libvirt-vga-passtrough

New guide for vga-passtrough VMs with STOCK kernel on Arch with libvirt.

Install libvirt, virt-manager, latest stock kernel, ovmf-bin. ovmf-bin may need to come from the AUR. Check if your graphics card is UEFI compilant. If not, search for a rom/gpu bios file that does support UEFI and store it somewhere.

** You may need to run your host on UEFI as well if using the i915 as primary graphics. **

If you get permission issues, try running the qemu instances as root. Edit /etc/libvirt/qemu.conf for this.

@maikelwever
maikelwever / .bashrc
Created March 7, 2012 17:06
bashrc, git branch
# Put your fun stuff here.
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}") "
}
export PS1="\t \[\033[01;32m\]\u\[\033[01;35m\]@\[\033[01;33m\]\h\[\033[01;35m\] \w \[\033[00m\]\$(parse_git_branch)\[\033[01;35m\]\$\[\033[00m\] "
@maikelwever
maikelwever / query.py
Created February 9, 2016 13:54
UT4 server query in Python
#!/usr/bin/env python2
#
# UT4 Server query script by maikoool (github.com/maikelwever)
#
# With many thanks to Sp0ngeb0b from the UT forums which made the initial Perl version this was copied from.
# https://forums.unrealtournament.com/showthread.php?19208-UT4-Server-HUB-Query-Perl-PHP-(HUB-Query-added!)
#
import binascii
import socket
@maikelwever
maikelwever / post_command.js
Created April 11, 2012 01:52
post_command.js
function post_command(command, arguments) {
datastring = "command=" + command + "&arguments=" + arguments;
$.post('/console/', datastring, function(data) {
if (data.length > 0) {
$("#hyperResponse").append(data.message);
}
}, 'json');
}
// get the element we want to rotate
var target = document.getElementsByTagName("html")[0], timer;
// function that makes the site rotate
function rotate(degree) {
// clear any existing timers
clearTimeout(timer);
// set style for webkit browsers
target.style['-webkit-transform'] = 'rotate(' + degree + 'deg)';
// set style for mozilla browsers
@maikelwever
maikelwever / verslag.md
Created February 2, 2012 16:37
Verslag

Verlag Project Containing

Herman ten Hoor Richard Brouwer Sietse van der Molen

@maikelwever
maikelwever / requirements.txt
Created December 16, 2011 00:31
pip requirements file useful for django debugging
-e git://github.com/django-debug-toolbar/django-debug-toolbar.git#egg=Package
-e git://github.com/jbalogh/django-debug-cache-panel.git#egg=Package
@maikelwever
maikelwever / apispam3000xl.py
Created December 6, 2011 19:17
apispam3000xl
#! /usr/bin/env python
import time
import urllib
import random
import sys
server = str("http://10.0.0.8/")
apikeys =[