Skip to content

Instantly share code, notes, and snippets.

View masami256's full-sized avatar
😎
😊

Masami Ichikawa masami256

😎
😊
View GitHub Profile
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sched.h>
#include <sys/types.h>
#include <sys/wait.h>
#define SCHED_LIFO 7
#define GET_CURRENT_POLICY 9999
@masami256
masami256 / Makefile
Last active September 22, 2015 04:03
kmem_cache_alloc_bulk() test
KERNDIR := /lib/modules/`uname -r`/build
BUILD_DIR := $(shell pwd)
VERBOSE = 0
obj-m := bulk_alloc.o
smallmod-objs := bulk_alloc.o
all:
make -C $(KERNDIR) SUBDIRS=$(BUILD_DIR) KBUILD_VERBOSE=$(VERBOSE) modules
#!/usr/bin/env ruby
def read_file(filename)
ret = []
File.open(filename) do |f|
f.each_line do |line|
ret << line.split(',')[1].to_i
end
end
return ret
@masami256
masami256 / emu23.rb
Last active August 29, 2015 16:17
自作エミュレータで学ぶx86アーキテクチャ emu2.3のruby版
#!/usr/bin/env ruby
require 'pp'
class Emulator
@@EAX = 0
@@ECX = 1
@@EDX = 2
@@EBX = 3
@masami256
masami256 / installkernel
Last active August 29, 2015 14:27
install bzImage to /boot, create initramfs, create boot conf for gummiboot
#!/bin/bash
if [ $# != 4 ]; then
echo "usage $0 [vmlinuz name] [bzimage file name] [System.map file name] [output dir]"
exit 1
fi
KERNEL_NAME=$1
BZIMAGE_NAME=$2
SYSTEMMAP_NAME=$3
@masami256
masami256 / print_bps.py
Last active September 1, 2015 09:11
simple traffic measurement
#!/usr/bin/env python
import time
import sys
last_rx = 0
last_tx = 0
first_time = True
def print_bps(iface, line):
@masami256
masami256 / add_extra_func_Test.js
Created May 22, 2015 16:09
Add extra functions to wd
"use strict";
var wd = require("wd");
require('colors');
var chai = require("chai");
var chaiAsPromised = require("chai-as-promised");
chai.use(chaiAsPromised);
var should = chai.should();
chaiAsPromised.transferPromiseness = wd.transferPromiseness;
@masami256
masami256 / suppory_python_2_and_3.patch
Created July 4, 2014 09:13
Support python2 and python3 in api.py
diff --git a/scripts/osv/modules/api.py b/scripts/osv/modules/api.py
index 59a709d..264e572 100644
--- a/scripts/osv/modules/api.py
+++ b/scripts/osv/modules/api.py
@@ -26,10 +26,17 @@ class java_app(object):
def get_jvm_args(self):
return []
+def get_string_object():
+ import sys
@masami256
masami256 / arch_build.patch
Created July 1, 2014 14:43
archでOSvをビルドするhackなパッチ
diff --git a/scripts/osv/modules/api.py b/scripts/osv/modules/api.py
index 59a709d..7b88415 100644
--- a/scripts/osv/modules/api.py
+++ b/scripts/osv/modules/api.py
@@ -29,7 +29,7 @@ class java_app(object):
def _to_args_list(text_or_list):
if not text_or_list:
return []
- if isinstance(text_or_list, basestring):
+ if isinstance(text_or_list, str):
@masami256
masami256 / redmine_user_import.patch
Last active August 29, 2015 14:00
前に作ったredmine_user_importのパッチ
diff -Naur redmine_user_import.orig/app/views/user_import/match.html.erb redmine_user_import/app/views/user_import/match.html.erb
--- redmine_user_import.orig/app/views/user_import/match.html.erb 2011-03-22 08:29:36.000000000 +0900
+++ redmine_user_import/app/views/user_import/match.html.erb 2012-03-28 15:50:34.000000000 +0900
@@ -19,7 +19,7 @@
<% end %>
<hr/>
-<%= t(:label_toplines, { :original_filename => @original_filename } ) %>
+<%= t(:label_toplines, { :line => @original_filename } ) %>
<table class="list">