Skip to content

Instantly share code, notes, and snippets.

[liuexp@liuexp virthualenv]$ cabal install
Resolving dependencies...
Configuring virthualenv-0.2.1...
Building virthualenv-0.2.1...
Preprocessing executable 'virthualenv' for virthualenv-0.2.1...
[ 6 of 13] Compiling MyMonad ( src/MyMonad.hs, dist/build/virthualenv/virthualenv-tmp/MyMonad.o )
src/MyMonad.hs:37:49:
No instance for (Exception a0) arising from a use of `catch'
The type variable `a0' is ambiguous
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module MyMonad ( MyMonad
, runMyMonad
, indentMessages
, debug
, info
, trace
, warning
, finally
, throwError
@liuexp
liuexp / win7a.cfg
Created November 1, 2012 15:39
xen-win7a
builder='hvm'
memory = 8192
shadow_memory = 1024
name = "win7a"
vcpus='5'
vif = [ 'bridge=xenbr0,type=ioemu' ]
disk = [
'phy:/dev/vg0/win7,xvda,w', 'phy:/dev/sr0,xvdc:cdrom,r',
]
boot="cd"
@liuexp
liuexp / gist:4002524
Created November 2, 2012 16:39
mem range for NVIDIA card
[liuexp@workstation xen]$ dmesg | grep 03:00.0 | grep "pci.*mem"
[ 0.856888] pci 0000:03:00.0: reg 10: [mem 0xf6000000-0xf6ffffff]
[ 0.856898] pci 0000:03:00.0: reg 14: [mem 0xd8000000-0xdfffffff 64bit pref]
[ 0.856908] pci 0000:03:00.0: reg 1c: [mem 0xe0000000-0xe1ffffff 64bit pref]
[ 0.856922] pci 0000:03:00.0: reg 30: [mem 0xf7e00000-0xf7e7ffff pref]
[liuexp@workstation xen]$ dmesg | grep 04:00.0 | grep "pci.*mem"
[ 0.866798] pci 0000:04:00.0: reg 10: [mem 0xf4000000-0xf5ffffff]
[ 0.866809] pci 0000:04:00.0: reg 14: [mem 0xe8000000-0xefffffff 64bit pref]
[ 0.866820] pci 0000:04:00.0: reg 1c: [mem 0xe4000000-0xe7ffffff 64bit pref]
[ 0.866834] pci 0000:04:00.0: reg 30: [mem 0xf3f00000-0xf3f7ffff pref]
@liuexp
liuexp / xen-init.sh
Created November 2, 2012 16:43
xen-network init
#!/bin/sh
#network
rc.d stop networkmanager
rc.d start network
brctl addbr xenbr0
brctl addif xenbr0 eth0
dhclient xenbr0
rc.d restart network
@liuexp
liuexp / xl.log
Created November 2, 2012 16:46
libxl__device_pci_reset
Waiting for domain win8a (domid 3) to die [pid 2097]
Domain 3 has shut down, reason code 0 0x0
Action for shutdown reason code 0 is destroy
Domain 3 needs to be cleaned up: destroying the domain
libxl: error: libxl_pci.c:1001:libxl__device_pci_reset: The kernel doesn't support reset from sysfs for PCI device 0000:04:00.0
libxl: error: libxl_pci.c:1001:libxl__device_pci_reset: The kernel doesn't support reset from sysfs for PCI device 0000:04:00.1
Done. Exiting now
@liuexp
liuexp / rev25070.patch
Created November 3, 2012 05:10
patch for xen-unstable-rev25070
diff -r bf249cd5f2c1 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile Tue Oct 30 18:12:11 2012 +0000
+++ b/tools/firmware/hvmloader/Makefile Sat Nov 03 13:05:29 2012 +0800
@@ -66,6 +66,7 @@
ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest
ROMS += $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) $(ETHERBOOT_ROMS)
endif
+PTVGA_ROM := ../vgabios/vgabios-pt.bin
ifeq ($(CONFIG_SEABIOS),y)
@liuexp
liuexp / gist:4036794
Created November 8, 2012 04:28
show in hex in ghci
show16 = concatMap (\x -> [(['0'..'9']++['a'..'z'])!!x]) . digits 16
{-# OPTIONS_GHC -XFlexibleInstances #-}
{-# OPTIONS_GHC -XTypeSynonymInstances #-}
{-# OPTIONS_GHC -O2 #-}
module Main where
import Data.List.Ordered(union,minus,nub)
import Data.List hiding(union,nub)
import Data.Set(Set)
import Data.Map(Map)
import qualified Data.Set as DS
public static Field fromBytes(byte[] y){
ByteBuffer buf = java.nio.ByteBuffer.wrap(y);
int length=0;
int type = buf.getInt();
switch(type){
case java.sql.Types.BOOLEAN:
return new BOOL(buf.get()==0?false:true);
case java.sql.Types.CHAR:
// FIXME this should be fixed-length
length = buf.getInt();