Skip to content

Instantly share code, notes, and snippets.

@paulc
paulc / gist:1524788
Created December 27, 2011 18:57
VDS6 FreeBSD Setup

pkg_add:

vim-lite 
sudo 
zsh 

/etc/rc.conf:

sshd_enable="YES" 

hostname="vds6.pchak.net"

@paulc
paulc / gist:1525312
Created December 27, 2011 22:09
VIM Config
set nocompatible
set nomodeline
set hidden
set bs=2
set ai
set tabstop=4
set shiftwidth=4
set expandtab
set smarttab
@paulc
paulc / gist:1525313
Created December 27, 2011 22:10
ZSH zprofile
PROMPT="%B[%m:%n] %24<..<%~ %#%b "
RPROMPT="%B%w %T%b"
export EDITOR="vim"
export DISPLAY=:0.0
bindkey -e
set -o EXTENDED_GLOB
set -o AUTO_MENU
@paulc
paulc / joker-ddns.sh
Created February 12, 2012 10:01
Simple script to update joker.com DDNS
#!/bin/sh
set -x
NS=a.ns.joker.com
HOSTNAME=
USERNAME=
PASSWORD=
DDNS=$(dig @$NS $HOSTNAME +short)
@paulc
paulc / _c.sh
Last active April 8, 2021 22:15
Simple shell wrapper to log execution & return status of command and (optionally) colourise output.
trap 'rm -f /tmp/err.* /tmp/out.*' EXIT
_NORMAL=$(printf "\033[0m")
_RED=$(printf "\033[0;31m")
_YELLOW=$(printf "\033[0;33m")
_CYAN=$(printf "\033[0;36m")
export _CLOG=${_CLOG:-log-$(date +%Y%m%d%H%M%S)}
_c() {
@paulc
paulc / functions.sh
Created August 29, 2013 15:56
Useful /bin/sh functions
_NORMAL=$(printf "\033[0m")
_RED=$(printf "\033[0;31m")
_CYAN=$(printf "\033[0;36m")
_log() {
local _cmd="$@"
printf "${COLOUR:+${_RED}}"
printf "%s [%s] %-40s\n" "$(date '+%b %d %T')" $name "CMD: $_cmd"
printf "${COLOUR:+${_CYAN}}"
@paulc
paulc / network_settings.sh
Created August 30, 2013 13:29
Grab FreeBSD network settings
_check() {
[ "$1" = "-echo" ] && shift && local _echo=1
local _var="$1"
local _msg="$2"
local _default="$3"
local _r
if [ ${#_default} -gt 0 ]
then
read -p "${_msg} [${_default}]: " _r
@paulc
paulc / cputemp.sh
Created August 30, 2013 13:30
FreeBSD CPU temp (requires core temp kmod)
#!/bin/sh
while :
do
clear
sysctl dev.cpu.0.temperature dev.cpu.1.temperature dev.cpu.2.temperature dev.cpu.3.temperature
sleep 1
done
@paulc
paulc / reboot.txt
Created August 30, 2013 13:34
OVH Reboot Log
Aug 29 18:54:05 ks3352212 kernel: FreeBSD 9.1-RELEASE-p6 #0: Wed Aug 21 20:40:52 UTC 2013
Aug 29 19:52:20 ks3352212 kernel: FreeBSD 9.1-RELEASE-p6 #0: Wed Aug 21 20:40:52 UTC 2013
Aug 29 20:59:11 ks3352212 kernel: FreeBSD 9.1-RELEASE-p6 #0: Wed Aug 21 20:40:52 UTC 2013
Aug 29 22:45:59 ks3352212 kernel: FreeBSD 9.1-RELEASE-p6 #0: Wed Aug 21 20:40:52 UTC 2013
Aug 29 22:48:49 ks3352212 kernel: FreeBSD 9.1-RELEASE-p6 #0: Wed Aug 21 20:40:52 UTC 2013
Aug 30 08:26:17 ks3352212 kernel: FreeBSD 9.1-RELEASE-p6 #0: Wed Aug 21 20:40:52 UTC 2013
Aug 30 09:22:29 ks3352212 kernel: FreeBSD 9.2-RC3 #0 r254795: Sat Aug 24 20:25:04 UTC 2013
Aug 30 09:54:10 ks3352212 kernel: FreeBSD 9.2-RC3 #0 r254795: Sat Aug 24 20:25:04 UTC 2013
Aug 30 10:36:06 ks3352212 kernel: FreeBSD 9.2-RC3 #0 r254795: Sat Aug 24 20:25:04 UTC 2013
Aug 30 10:49:32 ks3352212 kernel: FreeBSD 9.2-RC3 #0 r254795: Sat Aug 24 20:25:04 UTC 2013
@paulc
paulc / lex.py
Last active August 21, 2022 05:43
Simple python lexer
import collections,string
try:
from StringIO import StringIO
except ImportError:
from io import (StringIO,BytesIO)
class Lexer(object):
"""