Skip to content

Instantly share code, notes, and snippets.

@caglar10ur
caglar10ur / gist:4156522
Created November 27, 2012 19:42
Poor man's siginterrupt (for python < 2.6)
import ctypes
def siginterrupt(signum, flag):
libc = ctypes.CDLL("libc.so.6")
if libc.siginterrupt(signum, flag) != 0:
raise OSError("siginterrupt failed")
@caglar10ur
caglar10ur / wpa_supplicant.conf
Last active October 27, 2017 21:36
/etc/wpa_supplicant/wpa_supplicant.conf for Edimax EW-7811Un on Raspberry Pi
/etc/network/interfaces
---------------------------------------
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet dhcp
pre-up wpa_supplicant -Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B
@caglar10ur
caglar10ur / gist:4601441
Created January 23, 2013 02:52
Installing Go on the Raspberry Pi
# apt-get install -y mercurial gcc libc6-dev
# hg clone -u default https://code.google.com/p/go /opt/go
# cd /opt/go/src
# ./make.bash
# echo "PATH=\"\$PATH:/opt/go/bin\"" > /etc/profile.d/go.sh
@caglar10ur
caglar10ur / gist:4601472
Last active December 11, 2015 12:38
Customizations for Raspbian
# apt-get update
# apt-get dist-upgrade
# apt-get install screen vim git avahi-daemon chkconfig watchdog mc libzmq-dev libzmq1 netatalk
# modprobe bcm2708_wdog
# echo "bcm2708_wdog" >>/etc/modules
# chkconfig watchdog on
# cat /etc/watchdog.conf | grep -v ^#
@caglar10ur
caglar10ur / gist:4973291
Created February 17, 2013 20:29
XBMC on raspik
sudo echo "deb http://archive.mene.za.net/raspbian wheezy contrib" > /etc/apt/sources.list.d/mene.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 5243CDED
sudo apt-get update
sudo apt-get install xbmc
@caglar10ur
caglar10ur / gist:5273191
Last active December 15, 2015 14:19
configure flags for LXC
ubuntu:
CFLAGS="-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security" CPPFLAGS="-D_FORTIFY_SOURCE=2" CXXFLAGS="-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security" FFLAGS="-g -O2" LDFLAGS="-Wl,-Bsymbolic-functions -Wl,-z,relro" ./configure --prefix=/usr --sysconfdir=/etc --bindir=/usr/bin --libdir=/usr/lib/x86_64-linux-gnu/ --libexecdir=/usr/lib/x86_64-linux-gnu/ --with-rootfs-path=/usr/lib/x86_64-linux-gnu/lxc --localstatedir=/var --includedir=/usr/include --enable-tests --enable-cgmanager
fedora20:
./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-python --disable-rpath --with-init-script=s
@caglar10ur
caglar10ur / tmux.sh
Last active May 10, 2019 18:36
tmux.sh
#!/bin/sh
export PATH=$PATH:/usr/local/bin
# abort if we're already inside a TMUX session
[ "$TMUX" == "" ] || exit 0
# startup a "default" session if none currently exists
tmux has-session -t DEFAULT || tmux new-session -s DEFAULT -d
# present menu for user to choose which workspace to open
@caglar10ur
caglar10ur / Go 1.2
Last active December 23, 2015 16:29
Go 1.2
go get code.google.com/p/go.tools/cmd/godoc
go get code.google.com/p/go.tools/cmd/vet
go get code.google.com/p/go.tools/cmd/cover
go get github.com/golang/lint/golint
go get -u code.google.com/p/go.tools/cmd/godoc
go get -u code.google.com/p/go.tools/cmd/vet
go get -u code.google.com/p/go.tools/cmd/cover
go get -u github.com/golang/lint/golint
@caglar10ur
caglar10ur / martini.go
Created December 1, 2013 06:00
martini with pprof
package main
import (
"github.com/codegangsta/martini"
"net/http/pprof"
)
func main() {
m := martini.Classic()
@caglar10ur
caglar10ur / lxc.net
Last active December 31, 2015 16:19
LXC Network@Raspik
#!/bin/sh
### BEGIN INIT INFO
# Provides: lxc
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: LXC Bridge
### END INIT INFO