Skip to content

Instantly share code, notes, and snippets.

View PVince81's full-sized avatar

Vincent Petry PVince81

  • Stuttgart, Germany
View GitHub Profile
@PVince81
PVince81 / git-pr
Created February 10, 2017 09:00
Open the Github Pull Request page for the current branch with optional target branch
#!/bin/bash
# Inspired by http://www.devthought.com/code/create-a-github-pull-request-from-the-terminal/
targetbranch=master
if test "$1"; then
targetbranch=$1
fi
repo=`git remote -v | grep -m 1 "(push)" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"`
@PVince81
PVince81 / gist:63800bffd437f2175da9
Last active June 16, 2021 05:54
build-sdl2-for-torchlight.sh
# set this to your Torchlight directory
TORCHLIGHTDIR=$HOME/games/Torchlight
hg clone http://hg.libsdl.org/SDL
# check out the revision before the one that introduces the bug as advised here: http://forums.runicgames.com/viewtopic.php?f=24&t=33360&start=60#p474739
hg up 4de584a3a027 --clean
# Fix X11 compilation issues with another changeset
hg export 6caad66a4966 > patch
hg import patch
@PVince81
PVince81 / xpsfixheadsetnoise.py
Last active August 29, 2015 14:02
XPS 13 fix headset playback white noise
#!/usr/bin/env python
import os
import struct
from fcntl import ioctl
def __ioctl_val(val):
# workaround for OverFlow bug in python 2.4
if val & 0x80000000:
return -((val^0xffffffff)+1)
@PVince81
PVince81 / AndroidMultiTouch.java
Created January 19, 2013 18:07
Making sense of multitouch on Android. The purpose is being able to track drag event for multiple pointers. There is a major confusion between pointer ID, action index and how they should be used.
public boolean onTouchEvent(MotionEvent m) {
int pointerCount = m.getPointerCount();
int action = m.getActionMasked();
String actionString;
if ( action == MotionEvent.ACTION_MOVE ){
// we don't know which one moved, so process them all
for ( int i = 0; i < pointerCount; i++ ){