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
>>> def singleton(klass):
... inst = klass()
... return lambda:inst
...
>>> @singleton
... class Bar:
... pass
...
>>> Bar()
<__main__.Bar instance at 0x7fea76c054d0>
Python 2.6.5+ (release26-maint, Jul 6 2010, 12:58:20)
[GCC 4.4.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo:
... def __call__(self):
... return self
...
>>> Foo()
<__main__.Foo instance at 0x7fea76c053f8>
>>> Foo()
(provide :neural-networks)
(define-package :neural-networks
:uses '(:dfsch))
(in-package :neural-networks)
(define (sigmoid x)
(tanh x))
(define (dsigmoid y)
(- 1.0 (expt y 2)))
/\___/\ dfsch version 0.4.0-dev
( o o ) (rel-0.3.0-608-g01512d6) [Sep 29 2010 23:47:34]
== * == dfsch is free software, and you are welcome to redistribute it
) ( under certain conditions; see file COPYING for details.
]=> (define-method (foo x y) (current-environment ))
#<method 0x1cf02d0 (foo x y)>
]=> (foo 4 5)
#<environment 0x1cdce60 >
]=> ;inspect-result
object 0x1cdce60 is an environment-frame
Unhandled error condition!
#<error 0x24a1ba0 :object (#<standard-generic-function 0x2423680 make-variable> (#<widget 0x24bd2a0 path: ".win1.winc" context: #<context 0x24b4b40 interpreter: #<tk-gui-interface:interpreter 0x24af3f0 > top-level-window: #<window 0x24b38c0 command-list: () variable-list: () on-delete: #<function 0x24b5380 (window )> destroyed?: () path: "." context: #<context 0x24b4b40 interpreter: #<tk-gui-interface:interpreter 0x24af3f0 > top-level-window: #<window 0x24b38c0 command-list: () variable-list: () on-delete: #<function 0x24b5380 (window )> destroyed?: () path: "." context: #<context 0x24b4b40 interpreter: #<tk-gui-interface:interpreter 0x24af3f0 > top-level-window: #<window 0x24b38c0 command-list: () variable-list: () on-delete: ... destroyed?: () path: ... context: ... window: ... > > window: #<window 0x24b38c0 command-list: () variable-list: () on-delete: #<function 0x24b5380 (... )> destroyed?: () path: "." context: #<context 0x24b4b40 interpreter: ... top-level-window: ... >
# mke2fs -b 4096 /dev/sdc1 -N -1
mke2fs 1.41.9 (22-Aug-2009)
mke2fs: inode_size (128) * inodes_count (4294967295) too big for a
filesystem with 25570 blocks, specify higher inode_ratio (-i)
or lower inode count (-N).
$26 = {type = 0x2b68b852cb80, next = 0x2b68b852cb40,
name = 0x2b68b831bab4 "dfsch", use_list = 0x0, sym_count = 0, mask = 63,
entries = 0x2b68b853ad00}
(gdb) print *((dfsch_package_t*)0x602e20)
$27 = {type = 0x2b68b852cb80, next = 0x2b68b852cb40,
name = 0x2b68b831bab4 "dfsch", use_list = 0x0, sym_count = 446, mask = 1023,
entries = 0x2062000}
SdlDotNet.Core.SdlException was unhandled
Message="Audio device hasn't been opened"
Source="SdlDotNet"
StackTrace:
at SdlDotNet.Audio.Mixer.Load(Byte[] data, Int64& size)
at SdlDotNet.Audio.Sound..ctor(Byte[] data)
at VNEngineSDL.Scenes.Scene001.Init()
at VNEngineSDL.Scenes.Commands.InitScene.Execute()
at VNEngineSDL.Drawing.Objects.Background.UpdateBG()
at VNEngineSDL.Drawing.LayerBackground.Draw()
Stacktrace:
at (wrapper managed-to-native) Tao.Sdl.Sdl.SDL_MapRGBA (intptr,byte,byte,byte,byte) <0x0006e>
at (wrapper managed-to-native) Tao.Sdl.Sdl.SDL_MapRGBA (intptr,byte,byte,byte,byte) <0xffffffff>
at SdlDotNet.Graphics.Surface.GetColorValue (System.Drawing.Color) <0x000e7>
at SdlDotNet.Graphics.Surface.Fill (System.Drawing.Rectangle,System.Drawing.Color) <0x00097>
at SdlDotNet.Graphics.Surface.Fill (System.Drawing.Color) <0x000bb>
at VNEngineSDL.Drawing.Objects.TextWindow..ctor () <0x00123>
at VNEngineSDL.Drawing.LayerText..ctor () <0x0004b>
at VNEngineSDL.Program..ctor () <0x000bb>