Skip to content

Instantly share code, notes, and snippets.

./configure --disable-shared --enable-libgcc --with-winssl --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smtp --disable-gopher
@paulc
paulc / dot.shrc
Last active April 8, 2021 22:16
FreeBSD 10.0 VM
# pw usermod -n root -s /bin/sh
# export ENV=${HOME}/.shrc
export EDITOR=vi
set -o emacs
alias ls="ls -F"
PS1="[${USER}@\H] \w \$ "
@paulc
paulc / jail_menu.rc
Last active April 8, 2021 22:16
jail_menu.rc
#!/usr/local/bin/rc
fn get_jail_id {
if ( !{ jls jid | grep $1 } ) {
/usr/sbin/jls name jid | !awk -v 'name=' ^ $1 '$1 == name { print $2; exit 1 }'
}
}
if ( ~ $#SSH_ORIGINAL_COMMAND 0 ) {
/usr/sbin/jls
@paulc
paulc / Bhyve guest config
Last active August 29, 2015 14:11
Freebsd - Bhyve Notes
#### /etc/start_if.vtnet0
ifconfig vtnet0 link 00:50:56:00:72:c4 up
#### /etc/rc.conf
hostname="vm0"
ifconfig_vtnet0="inet 144.76.8.90 netmask 255.255.255.224"
defaultrouter="144.76.8.65"
sshd_enable="YES"
sendmail_enable="NONE"
dumpdev="NO"
@paulc
paulc / tmux.conf
Last active August 29, 2015 14:12
tmux.conf
set -g utf8
set -g default-terminal "screen-256color"
set -g history-limit 10000
set -g prefix C-a
set-window-option -g utf8 on
unbind C-b
@paulc
paulc / keybase.md
Created April 7, 2015 21:17
Keybase

Keybase proof

I hereby claim:

  • I am paulchakravarti on github.
  • I am paulc (https://keybase.io/paulc) on keybase.
  • I have a public key whose fingerprint is 505C 3619 07E3 C74C EFD7 E6A2 09D7 B12D 158F 5FDC

To claim this, I am signing this object:

@paulc
paulc / lsusb_osx.py
Last active April 24, 2016 09:41
lsusb_osx.py
#!/usr/bin/python
from subprocess import check_output
from plistlib import readPlistFromString
def tab(n):
return " " * n
def print_hub(h,depth=0):
print tab(depth) + "--- {_name}".format(**h)
@paulc
paulc / jail.conf
Last active May 2, 2022 18:05
FreeBSD ZFS Jail
interface = "lo1";
host.hostname = "$name";
ip4.addr = "172.16.0.$n";
path = "/jail/run/$name";
exec.prestart = "/sbin/zfs clone zroot/jail/template/10.2-RELEASE/[email protected] zroot/jail/run/$name &&
/usr/sbin/sysrc -f /jail/run/$name/etc/rc.conf hostname=$name &&
/usr/sbin/sysrc -f /jail/run/$name/etc/rc.conf sshd_enable=YES &&
/usr/sbin/sysrc -f /jail/run/$name/etc/rc.conf sshd_flags=\"-o ListenAddress=172.16.0.$n\" &&
/usr/sbin/pw -R /jail/run/$name useradd -n u01 -m -w random &&
/usr/sbin/pw -R /jail/run/$name lock root &&
@paulc
paulc / dhclient-exit-hook
Created January 13, 2016 21:24
dhclient-exit-hoot to reconfigure SSHD ListenAddress if IP address changes
# Reconfigure SSHD ListenAddress if ip address changes
LOGGER="/usr/bin/logger -s -p user.notice -t dhclient-exit-hook"
old_ip_address=$(sysrc -n sshd_flags | \
sed -e 's/.*ListenAddress=\([0-9\.]*\) .*/\1/')
$LOGGER "($reason) SSHD ListenAddress ${old_ip_address} -> ${new_ip_address}"
@paulc
paulc / jail.conf
Created January 13, 2016 23:02
jail.conf
interface = "lo1";
host.hostname = "$name";
ip4.addr = "172.16.0.$ip";
path = "/jail/run/$name";
exec.prestart = "/sbin/zfs clone zroot/jail/template/10.2-RELEASE/[email protected] zroot/jail/run/$name &&
/usr/sbin/sysrc -f /jail/run/$name/etc/rc.conf hostname=$name &&
/sbin/mount -t devfs -o ruleset=4 . /jail/run/$name/dev";
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.poststop = "/sbin/umount /jail/run/$name/dev;