Skip to content

Instantly share code, notes, and snippets.

View lalinsky's full-sized avatar

Lukáš Lalinský lalinsky

View GitHub Profile
@lalinsky
lalinsky / fp-find.py
Created July 22, 2011 18:02
Locate audio snippets in a longer stream
def format_time(secs):
return "%d:%02d" % (secs / 60, secs % 60)
def invert(arr):
"""
Make a dictionary that with the array elements as keys and
their positions positions as values.
>>> invert([3, 1, 3, 6])
@lalinsky
lalinsky / fpcmp.py
Created August 8, 2011 16:52
Very simple way to compare Chromaprint fingerprints
import chromaprint
popcnt_table_8bit = [
0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
@lalinsky
lalinsky / ingest.php
Created April 18, 2012 20:34
Simple audio fingerprint matching in PHP
<?php
include "utils.php";
$fp = parse_fp($_GET['fp']);
$dbh = new PDO('mysql:host=localhost;dbname=fingerprint', 'fingerprint');
$dbh->beginTransaction();
$sth = $dbh->prepare("INSERT INTO fp (length) VALUES (?)");
@lalinsky
lalinsky / ffmpeg-configure-osx.sh
Created October 20, 2011 14:00
Configure static audio-only FFmpeg on OS X
#!/bin/sh
./configure \
--prefix=$PREFIX \
--enable-cross-compile \
--arch=$ARCH \
--target-os=darwin \
--cc="/usr/bin/gcc-4.0" \
--extra-ldflags="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch $ARCH" \
--extra-cflags="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch $ARCH" \
@lalinsky
lalinsky / ufwdelete.sh
Created January 3, 2020 06:58
Bulk delete UFW rules
ufw status numbered | grep '# XXX' | perl -p -e 's{\[\s*(\d+)\].*}{\1}' | sort -rn | xargs -L1 ufw --force delete
http://www.formz.com/fzsite1219/products/formz/update/formz_jr_trial.html
@lalinsky
lalinsky / server.py
Created April 29, 2013 09:55
Example audio fingerprint server using Chromaprint
import chromaprint
from flask import Flask, request, jsonify
SQL_TABLES = """
CREATE TABLE IF NOT EXISTS fingerprint
(
id INTEGER PRIMARY KEY,
fingerprint TEXT NOT NULL
[Desktop Entry]
Exec=env GTK_THEME=Adwaita:dark gnome-terminal
Name=Gnome Terminal (Dark)
GenericName=Terminal (Dark)
X-KDE-StartupNotify=true
Terminal=false
Type=Application
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c Modules/objc/objc-runtime-compat.m -o build/temp.macosx-10.6-intel-2.7/Modules/objc/objc-runtime-compat.o -DPyObjC_STRICT_DEBUGGING -DMACOSX -DPyObjC_BUILD_RELEASE=1006 -DMACOSX -g -fexceptions -Wall -Wstrict-prototypes -Wmissing-prototypes -Wformat=2 -W -Wpointer-arith -Wmissing-declarations -Wnested-externs -W -Wno-import -Wno-unknown-pragmas -Wshorten-64-to-32 -Ilibffi-src/include -Ilibffi-src/powerpc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
Modules/objc/objc-runtime-compat.m:885:17: error: cannot find interface declaration for 'Object'; did you mean 'NSObject'?
@implementation Object (NSObjectCompat)
^~~~~~
NSObject
@lalinsky
lalinsky / easykey.pcap
Created January 24, 2017 08:27
worlde easykey.25 win7 host