Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/lua
--[[
a parser for google-like search queries
]]--
lex_keywords = {
-- keywords with quotes
"([a-zA-Z]+)%s*:%s*[\"\']([^\"\']+)[\"\']",
-- keywords without quotes
# -*- coding: utf-8 -*-
from mapmatters.client import wms as wmsclient
from mapmatters.parser import wms as wmsparser
WMS_URL = "http://www.example.com/wms"
wms = wmsclient.WmsClient(WMS_URL)
parser = wmsparser.Service(wms.capabilities)
CREATE OR REPLACE FUNCTION posting_set_keywords(postingid integer, kw_array text[])
RETURNS void AS
$BODY$
begin
-- remove keywords which do not anymore exist
delete from test.posting_keyword where
posting_id=postingid and
keyword_id in (
select pl.keyword_id
from test.posting_keyword lk
@nmandery
nmandery / camera_audio_trigger.py
Created December 25, 2010 19:54
camera_audio_trigger.py
#!/usr/bin/python
import alsaaudio, time, audioop
import sys
import piggyphoto
# init camera
try:
C = piggyphoto.camera()
@nmandery
nmandery / wget_github.sh
Created March 15, 2011 16:59
bash function to download github tarballs
function wget_github {
GHUSER=$1
GHREPO=$2
wget --no-check-certificate "https://nodeload.github.com/$GHUSER/$GHREPO/tarball/master" -O "./$GHUSER-$GHREPO.tar.gz"
}
@nmandery
nmandery / size_schemata.sql
Created March 18, 2011 08:17
views to get relations sizes in postgresql
create or replace view public.size_schemata as
select table_schema,
pg_size_pretty(sum(pg_total_relation_size(table_schema || '."' || table_name || '"')::bigint)::bigint) As fulltblsize,
pg_size_pretty(sum(pg_relation_size(table_schema || '."' || table_name || '"')::bigint)::bigint) As justthetblsize
from information_schema.tables
where table_catalog = current_database()
group by table_schema
@nmandery
nmandery / hexcolor_to_mapserver.sql
Created March 29, 2011 08:59
convert hex colors to mapserver format in postgresql
create or replace function public.hexcolor_to_mapserver(hexcolor text) returns text as
$body$
declare
thexcolor text;
color_r int;
color_g int;
color_b int;
begin
thexcolor := trim(both ' ' from hexcolor);
if not thexcolor ~ '^#[0-9a-fA-F]{6}$' then
@nmandery
nmandery / odf-pack.sh
Created April 7, 2011 14:39
pack directories to odf files
#!/bin/sh
set -e
TSTAMP=$(date +%Y%m%d-%H%M%S)
INDIR="$1"
OUTFILE_BASE=$(echo "$INDIR" | sed 's/-unpacked//g' | sed 's/.odt//g')
OUTFILE="$OUTFILE_BASE.odt"
[ -d $INDIR ] || exit 1
@nmandery
nmandery / odf-unpack.sh
Created April 7, 2011 14:40
unpack odf files
#!/bin/sh
set -e
TSTAMP=$(date +%Y%m%d-%H%M%S)
ODFFILE=$1
ODFDIR="$ODFFILE-unpacked"
[ -f "$ODFFILE" ] || exit 1
@nmandery
nmandery / tripod-notes.txt
Created January 1, 2012 22:30
tripod notes
http://photography-on-the.net/forum/showthread.php?t=879433
http://photography-on-the.net/forum/showthread.php?t=929789
http://www.pixtus.com/forum/product-reviews/138424-benro-trcb069-travel-angel.html
http://www.benro.de/stative/travelangel.htm
http://www.canonclubitalia.com/public/forum/Benro-Travel-Angel-recensioni-con-t351810.html
http://blog.sebastianbober.com/2011/10/15/gear-review-giottos-vitruvian-vgrn8265-with-5501-652-ball-head/