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 / 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++ ){
@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 / 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 / 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 / ocformatlog.py
Last active February 15, 2017 10:05
Prettify owncloud log and parses stack traces out of the message
#!/usr/bin/python
import sys
import json
def expand_stack(data, count):
# detect stack
message = data['message']
stack_start = message.find('[{');
@PVince81
PVince81 / webdav-vs-rest.md
Last active July 30, 2023 16:05
Webdav vs REST
Operation Webdav REST
@PVince81
PVince81 / octest.sh
Created October 25, 2017 12:53
Run OC tests
#!/bin/bash
TEST_SUITE="$1"
SEARCH_FOLDERS="apps/*/tests tests/lib tests/unit"
if test -z "$TEST_SUITE"; then
if test -r Makefile; then
make test-php TEST_DATABASE=sqlite 2>&1 | tee octest.log
else
@PVince81
PVince81 / ncchatter
Last active November 4, 2020 09:59
Nextcloud chatter generator
#!/bin/bash
# replace accordingly
NC_URL="https://localhost"
USERS=(alice bob charles dave)
PASSWORD=test
EXPRESSIONS=("hello" "hello!" "goodbye" "bye" "how are you" "good, thank you")
while true;
@PVince81
PVince81 / nc_export_pics
Created January 11, 2021 09:26
nc_export_pics
#!/bin/bash
shopt -s nullglob
INPUT_DIR="$1"
OUTPUT_DIR="$INPUT_DIR"/out
TARGET_DIR="$2"
function syntax
{
echo "nc_export_pics /path/to/input /path/to/output" >&2
#!/bin/bash
NC_URL="https://nchost"
USERS=(alice bob charles dave)
PASSWORD=passwordcomeshere
C=1
SPECIFIC_ROOM="$1"