Skip to content

Instantly share code, notes, and snippets.

@caglar10ur
caglar10ur / gist:8461601
Last active January 3, 2016 12:19
configure flags for cgmanager
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=/bin --sbindir=/sbin --libdir=/lib/x86_64-linux-gnu/ --localstatedir=/var
[caglar@qp:~/go/src/github.com/caglar10ur/lxc(devel)] make test
==> Running go test
=== RUN TestVersion-2
--- PASS: TestVersion-2 (0.00 seconds)
lxc_test.go:40: LXC version: 1.0.0.beta2
=== RUN TestDefaultConfigPath-2
--- PASS: TestDefaultConfigPath-2 (0.00 seconds)
=== RUN TestSetConfigPath-2
--- PASS: TestSetConfigPath-2 (0.00 seconds)
=== RUN TestGetContainer-2
#!/bin/bash
if [ ! -f /usr/bin/uidmapshift ]; then
wget https://bazaar.launchpad.net/~serge-hallyn/+junk/nsexec/download/head:/uidmapshift.c-20121030152620-2zy9rkac9y6htoia-8/uidmapshift.c
gcc -o uidmapshift uidmapshift.c
sudo mv uidmapshift /usr/bin/uidmapshift
rm -f uidmapshift.c
fi
uid=$(grep $USER /etc/subuid | cut -d : -f 2)
@caglar10ur
caglar10ur / unprivileged.sh
Last active October 7, 2016 16:12
unprivileged.sh
#!/bin/bash
uid=$(grep $USER /etc/subuid | cut -d : -f 2)
gid=$(grep $USER /etc/subgid | cut -d : -f 2)
range=$(grep $USER /etc/subuid | cut -d : -f 3)
NOCOLOR="\033[0m"
OKCOLOR="\033[0;32m"
UNPRIVILEGED="unpriv"
@caglar10ur
caglar10ur / gist:8077658
Created December 22, 2013 02:12
process_lock
root 534 0.0 0.5 1426600 10264 ? Ss 21:03 0:00 lxc-test-concurrent -j 20 -i 100
root 570 0.0 0.0 2260 496 ? Ss 21:03 0:00 \_ init
root 650 0.0 0.0 2260 260 ? Ss 21:03 0:00 \_ /bin/sh /etc/init.d/rcS
root 659 0.0 0.0 2260 264 ? S 21:03 0:00 | \_ /bin/udhcpc
root 652 0.0 0.0 2260 276 ? Ss 21:03 0:00 \_ /bin/syslogd
root 547 0.0 0.5 1434800 10276 ? Ss 21:03 0:00 lxc-test-concurrent -j 20 -i 100
root 657 0.0 0.0 2260 496 ? Ss 21:03 0:00 \_ init
root 863 0.0 0.0 2260 260 ? Ss 21:03 0:00 \_ /bin/sh /etc/init.d/rcS
root 873 0.0 0.0 2260 264 ? S 21:03 0:00 | \_ /bin/udhcpc
root 870 0.0 0.0 2260 272 ? Ss 21:03 0:00 \_ /bin/syslogd
@caglar10ur
caglar10ur / gist:8034412
Created December 19, 2013 04:25
stuck concurrent start
Iteration 66/100 maxfd:3
Executing (create) for 10 containers...
Executing (start) for 10 containers...
Executing (stop) for 10 containers...
Executing (destroy) for 10 containers...
Iteration 67/100 maxfd:3
Executing (create) for 10 containers...
Executing (start) for 10 containers...
@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
@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 / 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 / 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