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 / 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 / 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 / keybase.md
Created April 9, 2015 15:04
keybase proof

Keybase proof

I hereby claim:

  • I am maikelwever on github.
  • I am maikelwever (https://keybase.io/maikelwever) on keybase.
  • I have a public key whose fingerprint is A1D1 543C E168 FED4 DA86 2DB9 633C 4A24 7BF3 B3D9

To claim this, I am signing this object:

@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 / vt-d-guide.rst
Last active August 29, 2015 14:06
The definitive guide to vga-passtrough with VT-d

The definitive guide to vga-passtrough with VT-d

This guide can also be reached under the shortlink: http://bit.ly/vt-d which may be useful once you are in your VM.

Ensure you have hardware support for VT-d and VT-x. In your host bios, set 'init display first' to 'iGPU'. Otherwise your AMD gpu will get initialized.

Follow the guide at: https://bbs.archlinux.org/viewtopic.php?id=162768

@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');
}
@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\] "
// 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