Skip to content

Instantly share code, notes, and snippets.

View papr's full-sized avatar
🏠
Working from home

Pablo Prietz papr

🏠
Working from home
  • Berlin
  • 18:24 (UTC +02:00)
View GitHub Profile
I got this kind of string
"101 Williges, Frank 102 Gimmler, Ursula 103 Meißner, Arno 104 Aufenanger, Michael 105 Kaiser-Wirz, Birgit 106 Becker, Friedhelm 107 Rüddenklau, Jutta 108 Mock, Andreas 118 Niemetz, Maria Luise 143 Rußhardt-Maurer, Iris"
and now I want to split it with a regular expression. One important point: the numbers should stay and be associated with the following name.
It would be really great, if someone could create a regex for this case. :)
Thank you!
<ul id="parties">
<?php
foreach($parties as $partei) {
$html = '<li title="'.$partei['label'].'">'.$partei['label'].' <input type="checkbox" /></li>';
echo(utf8_encode($html));
}
?>
</ul>
@papr
papr / gist:853042
Created March 3, 2011 16:28
Die überarbeitete Beschreibung der entsprechenden Facebook-Gruppe.
We couldn’t find that file to show.
@papr
papr / gist:1130394
Created August 7, 2011 13:52
Wie man selbst gesund bleibt und dabei andere in den Wahnsinn treibt.
via http://www.haha.at/sonstigetexte/sonstigetexte/Wie_man_selbst_gesund_bleibt_und_dabei_andere_in_den_Wahnsinn_treibt/
1. Verlasse das Kopiergerät mit folgenden Einstellungen: 200% verkleinern, A5 Papier, 99 Kopien.
2. Sitz in deinem Garten und zeige mit einem Fön auf vorbeifahrende Autos, um zu sehen, ob sie langsamer werden.
3. Fülle drei Wochen lang entkoffeinierten Kaffee in die Kaffeemaschine. Sobald alle ihre Koffeinsucht überwunden haben, gehe über zu Espresso.
4. Falls du ein Glasauge hast, tippe mit dem Füllfederhalter dagegen, wenn du mit jemandem sprichst.
5. Schreibe "Für sexuelle Gefälligkeiten" in die Verwendungszweck Zeile all deiner Überweisungen.
6. Befestige Moskito-Netze rund um deinen Schreibtisch.
7. Singe in der Oper mit.
8. Bestehe darauf, die Scheibenwischer in allen Wetterlagen laufenzu lassen, um "deren Leistung zu erhöhen".
@papr
papr / export_annotations.py
Created September 28, 2016 08:44
Exports pickled annotations to csv
import pickle, os, sys, csv
def load_object(file_path):
"""Taken from https://github.com/pupil-labs/pupil/blob/master/pupil_src/shared_modules/file_methods.py
Args:
file_path (str): Annotation pickle file
Returns:
list: Annotation dicts
import numpy as np
deduplication_offset = 1e-9
deduplication_counter = 0
timestamp_file_path = 'world_timestamps.npy'
print('Loading timestamps...')
timestamps = np.sort(np.load(timestamp_file_path))
import zmq
import msgpack as serializer
from time import sleep
# Connect to Pupil Capture
context = zmq.Context()
url = 'tcp://127.0.0.1:50020'
# Open a REQ socket. See http://zguide.zeromq.org/page:all#Ask-and-Ye-Shall-Receive
socket = zmq.Socket(context, zmq.REQ)
@papr
papr / devices.py
Created July 5, 2017 13:46 — forked from virtuald/devices.py
Enumerate all Windows audio devices using python+ctypes
import ctypes.wintypes
import ctypes as C
_dsound_dll = C.windll.LoadLibrary("dsound.dll")
_DirectSoundEnumerateW = _dsound_dll.DirectSoundCaptureEnumerateW
_LPDSENUMCALLBACK = C.WINFUNCTYPE(C.wintypes.BOOL,
C.wintypes.LPVOID,
C.wintypes.LPCWSTR,
C.wintypes.LPCWSTR,
from plugin import Plugin
from pyglui import ui
class Progress_Animator(Plugin):
def __init__(self, g_pool, animating=True):
super().__init__(g_pool)
self.accelerate = True
self.animating = animating
"""
Receive world camera data from Pupil using ZMQ.
Make sure the frame publisher plugin is loaded and confugured to gray or rgb
"""
import zmq
from msgpack import unpackb, packb
import numpy as np
import cv2
context = zmq.Context()