Skip to content

Instantly share code, notes, and snippets.

View enukane's full-sized avatar
🏠
Working from home

naoya Kaneko enukane

🏠
Working from home
View GitHub Profile
@enukane
enukane / gist:2397509
Created April 16, 2012 10:14
mahoyo-bgm.xp3-ogg-decoder : not working yet
fname = "m01s.ogg"
outfname = "unenc-m01s.ogg"
file = open(fname, "rb")
p "Processing #{fname}"
def decode_xor key, value
origin = 0
offset = 1
@enukane
enukane / gist:2958688
Created June 20, 2012 07:51
regexdiff for mruby : not knowing if it runs...
diff --git include/mrbconf.h include/mrbconf.h
index 21b8fea..2f4c4d5 100644
--- include/mrbconf.h
+++ include/mrbconf.h
@@ -14,7 +14,8 @@
#undef MRB_USE_FLOAT
/* -DDISABLE_XXXX to change to drop the feature */
-#define DISABLE_REGEXP /* regular expression classes */
+//#define DISABLE_REGEXP /* regular expression classes */
@enukane
enukane / gist:3197085
Created July 29, 2012 09:43
fix panic (sleeping thread) on vmmctl --destroy --vm=* when bhyve is runnning
Index: sys/amd64/vmm/vmm_dev.c
===================================================================
--- sys/amd64/vmm/vmm_dev.c (revision 238860)
+++ sys/amd64/vmm/vmm_dev.c (working copy)
@@ -378,7 +378,9 @@
* XXX must stop virtual machine instances that may be still
* running and cleanup their state.
*/
+ mtx_lock(&vmmdev_mtx);
SLIST_REMOVE(&head, sc, vmmdev_softc, link);
@enukane
enukane / gist:3200560
Created July 29, 2012 17:48
WIP: host-side virtio-9p mock device
Index: usr.sbin/bhyve/Makefile
===================================================================
--- usr.sbin/bhyve/Makefile (revision 238860)
+++ usr.sbin/bhyve/Makefile (working copy)
@@ -8,6 +8,7 @@
SRCS+= instruction_emul.c mevent.c
SRCS+= pci_emul.c pci_hostbridge.c pci_passthru.c pci_virtio_block.c
SRCS+= pci_virtio_net.c pci_uart.c pit_8254.c post.c rtc.c uart.c xmsr.c
+SRCS+= pci_virtio_9p.c
@enukane
enukane / gist:3200815
Created July 29, 2012 18:20
WIP: guest-side virtio-9p device driver mock
Index: sys/dev/virtio/9p/virtio_9p.c
===================================================================
--- sys/dev/virtio/9p/virtio_9p.c (revision 0)
+++ sys/dev/virtio/9p/virtio_9p.c (working copy)
@@ -0,0 +1,181 @@
+/*-
+ * Copyright (c) 2011, Bryan Venteicher <[email protected]>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
@enukane
enukane / gist:3255835
Created August 4, 2012 08:14
netbsd ovs 1.4.2
diff --git vswitchd/system-stats.c vswitchd/system-stats.c
index a3b4db4..68391ea 100644
--- vswitchd/system-stats.c
+++ vswitchd/system-stats.c
@@ -29,6 +29,8 @@
#include <sys/statvfs.h>
#endif
#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
@enukane
enukane / gist:3551798
Created August 31, 2012 11:45
ethervirtio.c : virtio-net for 9front, able to send ping, receive dhcp but dead when received more than 255 frames
#include "u.h"
#include "../port/lib.h"
#include "mem.h"
#include "dat.h"
#include "fns.h"
#include "io.h"
#include "ureg.h"
#include "../port/error.h"
#include "../port/netif.h"
@enukane
enukane / gist:3873521
Created October 11, 2012 16:13
testing sol
(´・ω・`)つ ~/Dev/Solution-for-PE/SOLVED % ../../mruby/bin/mruby prob8.rb (10/12/12 1:01)
prob8.rb:2: no method named concat (NoMethodError)
(´・ω・`)つ ~/Dev/Solution-for-PE/SOLVED % ../../mruby/bin/mruby prob13.rb (10/12/12 1:07)
prob13.rb:3: no method named gets (NoMethodError)
(´・ω・`)つ ~/Dev/Solution-for-PE/SOLVED % ../../mruby/bin/mruby prob14.rb (10/12/12 1:08)
prob14.rb:6: no method named even? (NoMethodError)
(´・ω・`)つ ~/Dev/Solution-for-PE/SOLVED % ../../mruby/bin/mruby prob16.rb
@enukane
enukane / gist:3873712
Created October 11, 2012 16:38
merged from hiraganafuck
def dprint str
end
class BrainFuckProc
def initialize
@tape = Array.new
@current_position = 0
end
def inc_pointer
@enukane
enukane / gist:4104597
Created November 18, 2012 11:12
console select script for mac
#!/usr/bin/ruby
# console record
home = ENV['HOME']
homecons = "#{home}/.console"
begin
if File::ftype(homecons) == "directory" then
# nothing to do
else
print "there is file \"#{homecons}\" : can't mkdir"