Skip to content

Instantly share code, notes, and snippets.

View kwilczynski's full-sized avatar

Krzysztof Wilczyński kwilczynski

  • Yokohama, Japan
  • 12:16 (UTC +09:00)
View GitHub Profile
@kwilczynski
kwilczynski / .bashrc
Created September 24, 2011 21:34
To set xterm-256color and nice prompt for git on Ubuntu
# Useful but slow against very large repositories.
GIT_PS1_SHOWDIRTYSTATE=true
# Use __git_ps1 function from git contributed package to do the work.
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[1;33m\]$(__git_ps1 " (%s)")\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(__git_ps1 " (%s")\$ '
fi
define iterator {
if $name =~ /test/ {
notice "found"
}
}
$a = ['abc', 'deftestghi', 'xyz']
iterator { $a: }
@kwilczynski
kwilczynski / network-interface-loopback.conf
Created September 28, 2011 23:26
Lucid upstart job that will emit fake event ...
description "Configure loopback network interface"
start on net-device-added INTERFACE=lo
stop on net-device-removed INTERFACE=lo
pre-start script
[ -d /var/run/network ] || /bin/mkdir -p /var/run/network
/sbin/ifconfig lo 127.0.0.1 up
@kwilczynski
kwilczynski / test.conf
Created September 28, 2011 23:33
Configuration of test LXC container based on Lucid
lxc.utsname = test
lxc.tty = 4
lxc.pts = 1024
lxc.network.type = veth
lxc.network.flags = up
lxc.network.name = eth0
lxc.network.hwaddr = 52:54:00:XX:YY:ZZ
lxc.network.ipv4 = 111.222.333.444/24
@kwilczynski
kwilczynski / lxc.conf
Created September 29, 2011 11:17
Lucid upstart job that will emit fake event ...
description "Container Upstart"
start on startup
script
rm -rf /var/run/*.pid
rm -rf /var/run/network/*
/sbin/initctl emit stopped JOB=udevtrigger --no-wait
/sbin/initctl emit started JOB=udev --no-wait
/sbin/initctl emit -n net-device-up IFACE=lo LOGICAL=lo ADDRFAM=inet METHOD=loopback --no-wait
@kwilczynski
kwilczynski / ip_vs_ctl.c
Created October 17, 2011 16:38
Missing ip_vs_rule_user struct
net/netfilter/ipvs/ip_vs_ctl.c: In function ‘__ip_vs_update_dest’:
net/netfilter/ipvs/ip_vs_ctl.c:773: error: ‘ur’ undeclared (first use in this function)
net/netfilter/ipvs/ip_vs_ctl.c:773: error: (Each undeclared identifier is reported only once
net/netfilter/ipvs/ip_vs_ctl.c:773: error: for each function it appears in.)
make[3]: *** [net/netfilter/ipvs/ip_vs_ctl.o] Error 1
make[2]: *** [net/netfilter/ipvs] Error 2
kwilczynski@natty:~/hp-nx_nic-4.0.556/driver$ modinfo ./nx_nic.ko
filename: ./nx_nic.ko
version: 4.0.556
license: GPL
description: HP Multi port (1/10) Gigabit Network Driver
author: Copyright (C) 2003 - 2008 NetXen, Inc.
srcversion: 885B43034A2B10AA7BDBA04
alias: pci:v00004040d00000100sv*sd*bc*sc*i*
alias: pci:v00004040d00000025sv*sd*bc*sc*i*
alias: pci:v00004040d00000024sv*sd*bc*sc*i*
@kwilczynski
kwilczynski / nsswitch.conf
Created November 28, 2011 13:27
Fix Ubuntu's name resoultion order
passwd: compat
group: compat
shadow: compat
hosts: files dns mdns4_minimal [NOTFOUND=return] mdns4
networks: files
protocols: db files
services: db files
ethers: db files
@kwilczynski
kwilczynski / default_gateway.rb
Created November 30, 2011 17:17
Default gateway fact, Mark II
#
# default_gateway.rb
#
# This fact provides information about the default gateway (or the "route of
# last resort" if you wish) that is available on the system ...
#
require 'facter'
if Facter.value(:kernel) == 'Linux'
@kwilczynski
kwilczynski / ruby_binary.rb
Created November 30, 2011 19:58
Fact to expose Ruby binary location
#
# ruby_binary.rb
#
require 'facter'
if Facter.value(:kernel) == 'Linux'
Facter.add('rubybinary') do
confine :kernel => :linux
setcode do