Skip to content

Instantly share code, notes, and snippets.

# A visitor pattern implementation in Python
class Visitor:
def visit(self, obj):
func_name = 'visit_' + obj.__class__.__name__
visit_func = getattr(self, func_name)
visit_func(obj)
def visit_Tree(self, obj):
pass
@magthe
magthe / gist:1420199
Created December 1, 2011 21:58
Patch for broadcom-wl to make it shut up about rssi
Index: broadcom-wl/src/src/wl/sys/wl_cfg80211.c
===================================================================
--- broadcom-wl.orig/src/src/wl/sys/wl_cfg80211.c
+++ broadcom-wl/src/src/wl/sys/wl_cfg80211.c
@@ -1466,7 +1466,7 @@ wl_cfg80211_get_station(struct wiphy *wi
scb_val.val = 0;
err = wl_dev_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t));
if (err) {
- WL_ERR(("Could not get rssi (%d)\n", err));
+ // WL_ERR(("Could not get rssi (%d)\n", err));
@magthe
magthe / incpkgrel.sh
Created November 15, 2010 08:35
Increase the pkgrel of a PKGBUILD for ArchLinux
#! /bin/bash
ifile=$1; shift
ofile=$1; shift
awk '/^pkgrel/ { match( $0, /^pkgrel=([[:digit:]]+)/, Arr ); printf "pkgrel=%s\n", Arr[1]+1 }
! /^pkgrel/ { print }
' ${ifile} > ${ofile}.tmp
mv ${ofile}.tmp ${ofile}