Skip to content

Instantly share code, notes, and snippets.

View attilaolah's full-sized avatar
🍂
Cleanup time.

Attila Oláh attilaolah

🍂
Cleanup time.
View GitHub Profile
@attilaolah
attilaolah / imgcmp.py
Created February 29, 2012 11:30
Fast image comparison with Python
import math
import Image
import Levenshtein
class BWImageCompare(object):
"""Compares two images (b/w)."""
_pixel = 255
@attilaolah
attilaolah / aiur-doo-legal-info
Last active October 2, 2015 13:38
Aiur d.o.o. legal information
@attilaolah
attilaolah / ext-define.coffee
Last active October 8, 2015 00:48
HTTP DELETE fix for Sencha Touch 2.1
Ext.define "MyApp.data.Connection",
override: "Ext.data.Connection"
setOptions: ->
options = @callParent arguments
if options.method is "DELETE"
options.data = null
options
@attilaolah
attilaolah / campervan
Last active December 10, 2015 13:58
CamperVan & irssi wrapper script
#! /usr/bin/env sh
RUBY_VERSION="1.9.1"
SERVER="${HOME}/.gem/ruby/${RUBY_VERSION}/bin/camper_van"
PIDFILE="/tmp/camper_van.pid"
if [ ! -e ${SERVER} ]; then
echo "CamperVan server not found at '${SERVER}'."
fi
@attilaolah
attilaolah / byobu-5.25.ebuild
Last active December 10, 2015 22:39
Ebuild for Byobu version 5.25
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI="4"
PYTHON_DEPEND="2"
inherit python
DESCRIPTION="A set of profiles for the GNU Screen console window manager (app-misc/screen)"
HOMEPAGE="https://launchpad.net/byobu"
import re
class WordFinder(object):
"""Searches text for words that conform to the given constraint.
To use it, instantiate it with any number of strings. These strings will be
used as constraints. For example, to find all words that contain the letter
'X' and the number '6', you can do something like this::
https://bugs.gentoo.org/show_bug.cgi?id=367425
diff -ruN fontforge-20110222~/fontforge/parsepdf.c fontforge-20110222/fontforge/parsepdf.c
--- fontforge-20110222~/fontforge/parsepdf.c 2011-02-15 05:37:39.000000000 +0200
+++ fontforge-20110222/fontforge/parsepdf.c 2011-05-17 22:19:56.000000000 +0300
@@ -759,7 +759,11 @@
if ( zlib!=NULL )
return( true );
- if ( (zlib = dlopen("libz" SO_EXT,RTLD_GLOBAL|RTLD_LAZY))==NULL ) {
@attilaolah
attilaolah / urllibbench.py
Created July 17, 2013 23:30
Generate urllib2 vs. urllib3 benchmark results, as described here: http://attilaolah.eu/2010/08/08/urllib-benchmark/
import csv
import random
import re
import time
import urllib2
import urllib3
any_protocol = re.compile('^[^#^\\?^/]+?:')
@attilaolah
attilaolah / domready.coffee
Last active February 13, 2020 17:44
JS & CoffeeScript DOM ready listeners
###
# Based on:
# jQuery JavaScript Library v1.4.2
# http://jquery.com/
#
# Copyright 2010, John Resig
# Dual licensed under the MIT or GPL Version 2 licenses.
# http://jquery.org/license
###
@attilaolah
attilaolah / batterymonitor.lua
Created July 18, 2013 00:00
Awesome WM battery monitor and CPU monitor widgets.
-- Hex converter, for RGB colors
function hex(inp)
return inp > 16 and string.format("%X", inp) or string.format("0%X", inp)
end
-- Battery monitor
mybattmon = widget({ type = "textbox", name = "mybattmon", align = "right" })
function battery_status ()
local output={} -- output buffer
local fd=io.popen("acpitool -b", "r") -- list present batteries