Skip to content

Instantly share code, notes, and snippets.

View phillipberndt's full-sized avatar

Phillip Berndt phillipberndt

View GitHub Profile
Haystack: babaacb
Needle: abab
Split into [ "babaa", "b" ]
> Match the longest substring with the input and keep track of the longest match.
> If you don't get a complete match, use the longest one to slice up the
> substring once more, and retry with the next longest substring.
There's no complete match, and the longest match is "bab". So splice up the substring again, and retry with
@phillipberndt
phillipberndt / gist:6623a5b4b57134e59b57
Created March 4, 2016 10:15
pqiv Aufruf um zu neuen Dateien zu springen
pqiv --watch-directories --sort-key=mtime --sort --end-of-files-action=wait --slideshow-interval=0.001 --slideshow test
--watch-directories -> Nach neuen Dateien suchen
--sort-key=mtime -> Nach Änderungsdatum sortieren, also ganz neue Dateien ans Ende
--sort
--end-of-files-action=wait -> Am Ende der Slideshow auf neue Dateien warten statt direkt von vorne neu zu starten
--slideshow-interval=0.001 -> Slideshow sehr schnell durchlaufen
--slideshow
@phillipberndt
phillipberndt / determine_dependency_versions.py
Last active December 25, 2015 02:09
Script to determine the exact versions of the GTK libraries required for pqiv. See https://github.com/phillipberndt/pqiv/issues/13
#!/usr/bin/env python
# encoding: utf-8
#
# Find minimal required versions of the gtk/gdk/gdk_pixbuf/glib/cairo libs
# for pqiv
#
import re
import sys
import urllib
@phillipberndt
phillipberndt / gist:5339943
Created April 8, 2013 19:54
Patch against Android Base framework, patched with 4.2 OpenPDroid patches from March 2013. Fixes the Cell Tower bug. Tested with an i9100 / cm10.1. This is probably bad coding style, see https://github.com/wsot/openpdroid_support/issues/1 for details.
diff --git a/services/java/com/android/server/PrivacyTelephonyRegistry.java b/services/java/com/android/server/PrivacyTelephonyRegistry.java
index 36f2d9e..95a3f58 100644
--- a/services/java/com/android/server/PrivacyTelephonyRegistry.java
+++ b/services/java/com/android/server/PrivacyTelephonyRegistry.java
@@ -44,17 +44,25 @@ public class PrivacyTelephonyRegistry extends TelephonyRegistry{
private static final int PERMISSION_CALL_STATE = 3;
private static final int PERMISSION_SERVICE_STATE = 4;
+
+ private Context _context;
@phillipberndt
phillipberndt / update_urlfilter.ini.pl
Created April 2, 2011 09:34
Update Opera's urlfilter.ini from secure.fanboy.co.nz while preserving custom entries
#!/usr/bin/perl -w
use LWP::Simple;
use Storable;
use strict;
# Configuration
# You can define multiple urlfilter.ini lists to be downloaded
my @remotes = qw(
http://secure.fanboy.co.nz/adblock/opera/urlfilter.ini
);
@phillipberndt
phillipberndt / xcbtest.c
Created June 24, 2015 13:18
test if fakexrandr supports xcb
/* compile with
gcc -oxcbtest xcbtest.c -lxcb -lxcb-randr -lX11 -lXrandr
*/
#include <xcb/xcb.h>
#include <xcb/randr.h>
#include <X11/extensions/Xrandr.h>
#include <X11/Xlibint.h>
@phillipberndt
phillipberndt / randr.c
Created June 24, 2015 16:05
xcb generated files for the randr extension for https://github.com/phillipberndt/fakexrandr/issues/16
/*
* This file generated automatically from randr.xml by c_client.py.
* Edit at your peril.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
void main() {
GtkTextIter start, end, inspos, tagpos;
gsize length;
GtkTextBuffer *buffer = gtk_text_buffer_new(NULL);
GtkTextTag *tag1 = gtk_text_buffer_create_tag(buffer, "tagone", NULL);
GtkTextTag *tag2 = gtk_text_buffer_create_tag(buffer, "tagtwo", NULL);
@phillipberndt
phillipberndt / autorandr.patch
Created May 18, 2015 08:43
autorandr patch to show DPI
diff --git a/autorandr.py b/autorandr.py
index 19722c9..6df9d9b 100755
--- a/autorandr.py
+++ b/autorandr.py
@@ -129,7 +129,8 @@ class XrandrOutput(object):
(?P<rotate>(?:normal|left|right|inverted))\s+ # Rotation
(?:(?P<reflect>X\ and\ Y|X|Y)\ axis)? # Reflection
)? # .. but everything of the above only if the screen is in use.
- (?:[\ \t]*\([^\)]+\))(?:\s*[0-9]+mm\sx\s[0-9]+mm)?
+ (?:[\ \t]*\([^\)]+\))\s*
diff --git a/libc/dns/net/getaddrinfo.c b/libc/dns/net/getaddrinfo.c
index 2612d6a..277afb0 100644
--- a/libc/dns/net/getaddrinfo.c
+++ b/libc/dns/net/getaddrinfo.c
@@ -80,6 +80,7 @@
#include <fcntl.h>
#include <sys/cdefs.h>
#include <sys/types.h>
+#include <time.h>
#include <sys/stat.h>