Skip to content

Instantly share code, notes, and snippets.

@adh
adh / gist:806333
Created February 1, 2011 18:32
Setup 6to4 and radvd with dynamic IPv4 address
#!/bin/bash
IPv4=`ip a | sed -n '/eth0/,$p' | grep '^[[:space:]]*inet' | head -n 1 | sed -r 's/^[[:space:]]*inet[[:space:]]+([[:digit:].]+).*$/\1/'`
prefix=` echo $IPv4 | tr '.' '\n' | sed '1iobase=16'| bc | sed 's/^.$/0\0/'| tr -d '\n' | sed 's/^..../\0:/'`
cat >/etc/radvd.conf << EOF
interface eth1
{
AdvSendAdvert on;
prefix 2002:$prefix:100::/64

Keybase proof

I hereby claim:

  • I am adh on github.
  • I am adh (https://keybase.io/adh) on keybase.
  • I have a public key whose fingerprint is 8F41 48A4 6D99 AED8 24B2 AFD7 4328 6C3B 9ABA 6EA4

To claim this, I am signing this object:

static void hexdump(unsigned char* buf, size_t len){
int i;
for(;;){
fprintf(stderr, " ");
for (i = 0; i < 16; i++){
if (len <= i){
fprintf(stderr, " ");
} else{
fprintf(stderr, "%02hhx ", buf[i]);
}
Unhandled serious condition!
#<error 0x1ad0a80 :object (dfsch%implementation:name . #<environment 0x1ac4000 >) :message "Unbound variable">
EVAL (test-toplevel) ()
@ main.scm:23
EVAL (when-toplevel (let ((one-fail? ()) (trap-errors? ())) (let ((parser (cmdopts:make-parser))) (cmdopts:add-option parser (lambda (p v) (set! one-fail? true)) :long-option "one-test-fail") (cmdopts:add-option parser (lambda (p v) (set! trap-errors? true)) :long-option "trap-errors") (cmdopts:parse-list parser (cdr *posix-argv*))) (case (run-all-tests :one-fail? one-fail? :trap-errors? trap-errors?) ((:fail) (os:exit 1)) ((:pass) (os:exit 0))))) ()
@ ../lib-scm/dfsch-unit.scm:267
EVAL (let ((one-fail? ()) (trap-errors? ())) (let ((parser (cmdopts:make-parser))) (cmdopts:add-option parser (lambda (p v) (set! one-fail? true)) :long-option "one-test-fail") (cmdopts:add-option parser (lambda (p v) (set! trap-errors? true)) :long-option "trap-errors") (cmdopts:parse-list parser (cdr *posix-argv*))) (case (run-all-tests
$ ./dfsch-repl -r introspect
/\___/\ dfsch version 0.4.0-dev
( o o ) (rel-0.3.0-1310-g60bdd37) [Feb 12 2012 13:38:31]
== * == dfsch is free software, and you are welcome to redistribute it
) ( under certain conditions; see file COPYING for details.
]=> (define (foo x y) (let ((nx (1+ x)) (ny (1+ y))) (display "mnau") (newline) (+ nx ny)))
#<standard-function 0xa852d0 foo(x y)>
]=> (add-function-breakpoint! foo)
#<standard-function 0xa852d0 foo(x y)>
]=> (+ 5 6)
breakpoint on (+ 5 6):
Local variables:
pathname-extension: #<primitive 0x7ff087182240 pathname_extension>
lookup-in-environment: #<primitive 0x7ff08718cfc0 lookup_in_environment>
destructuring-bind: #<form 0x7ff08717efa0 destructuring_bind>
find-package: #<primitive 0x7ff08717ca40 find_package>
define-generic-function: #<macro 0x7ff08718e2c0 %macro_define_generic_function>
most-negative-fixnum: -1152921504606846976
$ ./dfsch-repl -r introspect
/\___/\ dfsch version 0.4.0-dev
( o o ) (rel-0.3.0-1310-g60bdd37) [Feb 12 2012 13:38:31]
== * == dfsch is free software, and you are welcome to redistribute it
) ( under certain conditions; see file COPYING for details.
]=> (define (foo x y) (let ((nx (1+ x)) (ny (1+ y))) (display "mnau") (newline) (+ nx ny)))
#<standard-function 0x12b0aa0 foo(x y)>
]=> (add-function-breakpoint! foo)
#<standard-function 0x12b0aa0 foo(x y)>
/\___/\ dfsch version 0.4.0-dev
( o o ) (rel-0.3.0-1300-gef083bd) [Feb 10 2012 08:46:38]
== * == dfsch is free software, and you are welcome to redistribute it
) ( under certain conditions; see file COPYING for details.
]=> (define (fact x)
..> (if (< x 2)
..> 1
..> (* x (fact (1- x)))))
#<standard-function 0x1d23aa0 fact(x)>
;; Remove role list from list of class options
(set! class-opts (plist-remove-keys class-opts '(:roles)))
;; Evaluate list of roles in outer context
(set! roles (eval-list roles (%macro-expansion-environment)))
;; Extend used slot and options lists by matching lists in used roles
;; Also remove roles that conflict with superclass roles
(set! roles (map* (lambda (role-object)
(let ((role (assert-instance role-object <role>)))
]=> <standard-type>
#<meta-type 0x7f61d3bee000 standard-type instance-size: 152>
]=> ;inspect-result
object 0x7f61d3bee000 is a meta-type
Slots:
0: [name ] "standard-type"
1: [documentation] "Base metaclass representing common methods of all objects"
2: [superclass ] #<abstract-type 0x7f61d3c01d20 type-specializer instance-size: 0>
3: [roles ] ()