Skip to content

Instantly share code, notes, and snippets.

View masami256's full-sized avatar
😎
😊

Masami Ichikawa masami256

😎
😊
View GitHub Profile
@masami256
masami256 / yuyushiki.sh
Created January 9, 2014 11:48
ゆゆ式放送予定登録
#!/bin/bash
LC_ALL=en_US.UTF-8 ; export LC_ALL
TZ="Asia/Tokyo" ; export TZ
target_date=20140101
ep_num=36
max_count=55
@masami256
masami256 / distcc.rake
Created December 30, 2013 03:05
mrubyをdistccでビルドするときに使うrakeファイル
MRuby::Toolchain.new(:distcc) do |conf|
[conf.cc, conf.objc, conf.asm].each do |cc|
cc.command = ENV['CC'] || 'distcc'
end
[conf.cxx].each do |cxx|
cxx.command = ENV['CXX'] || 'distcc'
end
conf.linker do |linker|
@masami256
masami256 / find_function.sh
Created December 19, 2013 07:30
nmとgrepでシンボル探し
#!/bin/bash
target_dir=/lib/modules/`uname -r`/
target_type="ko"
func_name=""
function usage()
{
echo "usage: $1 -d [directory] -t [objecdt type(e.g. so, ko)] -f [function name]"
exit -1
@masami256
masami256 / net_eject.c
Created December 5, 2013 13:34
Ejectプロトコル。カーネルモジュールとしてビルドしてinsmodしたら任意のPCから"sudo sendip -p ipv4 -is 0 -f payload -ip 123 対象PCのIPアドレス"でCDドライブを開ける。
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/kmod.h>
#include <net/protocol.h>
MODULE_DESCRIPTION("simple Eject protocol");
MODULE_AUTHOR("masami256");
MODULE_LICENSE("GPL");
#define IPPROTO_NET_EJECT 123
@masami256
masami256 / locktest.c
Last active December 30, 2015 03:19
lockref、spinlock、atomic_incの比較。
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/smp.h>
#include <linux/time.h>
#include <linux/debugfs.h>
#include <linux/string.h>
MODULE_DESCRIPTION("lock test module");
MODULE_AUTHOR("masami256");
MODULE_LICENSE("GPL");
@masami256
masami256 / addrinfo.c
Last active December 23, 2015 06:09
getaddrinfo(3) と getnameinfo(3)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
enum {
Ip2Addr = 0,
@masami256
masami256 / add_header_file.patch
Created September 10, 2013 14:59
fsfuzzer-0.7のfstest.cのコンパイルエラーfixパッチ
--- fsfuzzer-0.7.orig/fstest.c 2009-01-25 23:50:06.000000000 +0900
+++ fsfuzzer-0.7.new/fstest.c 2013-09-10 23:56:36.735524372 +0900
@@ -35,6 +35,7 @@
#include <signal.h>
#include <sys/file.h>
#include <sys/mman.h>
+#include <sys/stat.h>
#define LOGGIT 1
#define CHECK_XATTR 1
@masami256
masami256 / blockip.py
Created July 11, 2013 02:03
HTTPのベーシック認証に辞書アタックしてきたらiptablesで弾く。
#!/usr/bin/env python
from datetime import timedelta
from datetime import datetime
import os
import io
import re
import csv
class LogData:
@masami256
masami256 / msg_fastopen_test.c
Created May 26, 2013 03:39
TCP FASTOPENテストコード
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#define SERVER_ADDR "127.0.0.1"
#define SERVER_PORT 1111
@masami256
masami256 / http_server.py
Created May 4, 2013 14:13
忘れるのでめも。pythonのhttpサーバ機能
#!/usr/bin/env python
import SimpleHTTPServer
import SocketServer
import sys
def run(port):
print "listening port is ", port
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler