Skip to content

Instantly share code, notes, and snippets.

# hspbp-topicgen ötletforrás
# http://github.com/dnet/hspbp-topicgen
#
# minden ötlet kerüljön külön sorba, a #-el kezdődő ill. üres sorok megjegyzések
# az ötletekben két ~s lehet, első a feladóra, második a tárgyra helyettesítődik be
# minta: [levlista] Felado: ~s || Targy: ~s
# az első IRC-s ötlet, később törölhető nyugodtan, csak ne legyen üres a fájl
kepzeljetek, ~s irt a levlistara ~s targgyal
~s már megint spammeli a listat ~s című levéllel.
@stef
stef / gist:591436
Created September 22, 2010 09:55
gives back geo locs for neighbouring wlan APs
for mac in $(iwlist wlan0 scan | grep -o 'Address: .*' | cut -d' ' -f2); do curl -d '{version:"1.1.0",request_address:true,wifi_towers:[{mac_address:"'$mac'"}]}' www.google.com/loc/json; done
@stef
stef / gist:844019
Created February 25, 2011 16:16
a map/reduce parallelizer
from multiprocessing import Pool, Process, Queue
class Multiplexer(object):
def __init__(self, _map, _reduce, threads=8):
self._map=_map
self._reduce=_reduce
self.consumer=Process(target=self.consume)
self.pool = Pool(threads) # reduce if less aggressive
self.q=Queue()
self.done=False
@stef
stef / ssli
Created March 31, 2011 01:05
downloads and caches ssl certificates
#!/bin/bash
BASEDIR="$HOME/.ssl"
function get {
echo | openssl s_client -showcerts -connect "$1":"$2" 2>/dev/null
}
function md5 {
openssl x509 -md5 -fingerprint -noout
@stef
stef / gist:1038042
Created June 21, 2011 15:04
tmux screenify
set-option -g prefix C-a
unbind-key C-b
bind-key a send-prefix
bind-key C-a last
set-option -g status-bg black
set-option -g status-fg white
set -g history-limit 5000
set -g base-index 1
setw -g utf8 on
set -g bell-action any
@stef
stef / dump_schema.py
Created July 30, 2011 13:27
samples a list of data-structures and displays a statistical representation of the underlying data schema, also can compare 2 composite datastructures... somewhat
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of composite data analysis tools (cdat)
# composite data analysis tools (cdat) is free software: you can
# redistribute it and/or modify it under the terms of the GNU
# Affero General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option)
# any later version.
@stef
stef / gist:1704278
Created January 30, 2012 13:00
omnom widget for displaying your latest bookmarks on your own site. chang
<h3><a href='http://links.ctrlc.hu/u/stf'>/dev/read</a></h3><div id="omnom-box" style="margin:0;padding:0;border:none;"> </div>
<script type="text/javascript" src="http://links.ctrlc.hu/u/stf/?format=json&j"></script>
<script type="text/javascript">
var ul = document.createElement('ul');
for (var i=0, post; post = omnom_posts[i]; i++) {
var li = document.createElement('li');
var a = document.createElement('a');
a.setAttribute('href', post.url);
a.appendChild(document.createTextNode(post.title));
li.appendChild(a);
@stef
stef / gist:1707350
Created January 30, 2012 23:00
ascii histogram of channel density
iwlist wlan0 scan | fgrep Channel: | sed 's/Channel://' | sort -n | uniq -c | sort -k2n | awk '{ print $2 " " $1 }' | awk '!max{max=$2;}{r="";i=s=$2/max;while(i-->0)r=r"#";printf "%3s %2d %s %s",$1,$2,r,"\n";}'
@stef
stef / screenfire
Created March 16, 2012 21:56
iirc this streams the contents of an x11 window via flash...
#!/bin/ksh
res=svga
eval $(xwininfo -frame | awk '/Absolute upper-left X/ { print "x="$NF }
/Absolute upper-left Y/ { print "y="$NF }
/Width/ { print "width="$NF }
/Height/ { print "height="$NF }')
offset=${x},${y}
res=$(( (width/16)*16))x$(( (height/16)*16))
@stef
stef / camp0costs.py
Last active December 22, 2015 16:08
this gist documents the costs of campzer0 and naively calculates the current ticket price based on the number of registered participants.
#!/usr/bin/env python
import sys
persons = int(sys.argv[1])
EUR = 300.169 # Mid-market rates: 2013-09-09 14:49 UTC
VAT = 1.27
# general costs (everything is in HUF)
power = 20000*VAT # power transmission to the campsite
shower = 234400*VAT # shower container rent