Skip to content

Instantly share code, notes, and snippets.

View hiboma's full-sized avatar

Hiroya Ito hiboma

View GitHub Profile
obj-m := sekigae.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
all:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
rm -rf *.o *.ko *.mod.c *~
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
int main()
{
printf("sleep over\n");
while(1)
{
int len=random()%(1024*1024)+1;
@hiboma
hiboma / Install-multiple-mod_php.c.diff
Last active December 16, 2015 15:59
Install multiple mod_php
diff -ur php-5.4.14.original/sapi/apache2handler/mod_php5.c php-5.4.14/sapi/apache2handler/mod_php5.c
--- php-5.4.14.original/sapi/apache2handler/mod_php5.c 2013-04-10 16:47:04.000000000 +0900
+++ php-5.4.14/sapi/apache2handler/mod_php5.c 2013-04-25 22:16:34.000000000 +0900
@@ -25,7 +25,7 @@
#include "php.h"
#include "php_apache.h"
-AP_MODULE_DECLARE_DATA module php5_module = {
+AP_MODULE_DECLARE_DATA module php54_module = {
STANDARD20_MODULE_STUFF,
//
// hibomaView.m
// hiboma
//
// Created by hiroya on 13/04/15.
// Copyright __MyCompanyName__ 2013. All rights reserved.
//
#import "hibomaView.h"
@hiboma
hiboma / kernel-signal.c.diff
Created February 23, 2013 01:38
patch for ``` sudo strace -p 1 & sudo kill -KILL 1 # kernel oops !!!! ```
--- kernel/signal.c.org 2013-02-23 10:35:53.025437034 +0900
+++ kernel/signal.c 2013-02-23 10:35:24.816437657 +0900
@@ -2307,6 +2307,9 @@
!sig_kernel_only(signr))
continue;
+ if (current == init_pid_ns.child_reaper)
+ continue;
+
if (sig_kernel_stop(signr)) {
Process 12297 attached - interrupt to quit
wait4(-1, 0x7ffff9bd18f4, 0, NULL) = ? ERESTARTSYS (To be restarted)
--- SIGHUP (Hangup) @ 0 (0) ---
rt_sigreturn(0) = -1 EINTR (Interrupted system call)
rt_sigprocmask(SIG_BLOCK, [HUP], NULL, 8) = 0
write(2, "=== killed by HUP. (12297) at /v"..., 130) = 130
write(2, "gracefull shutdowning. children:"..., 166) = 166
kill(13583, SIGUSR2) = 0
kill(13585, SIGUSR2) = 0
kill(13582, SIGUSR2) = 0
/**
* kthread_stop - stop a thread created by kthread_create().
* @k: thread created by kthread_create().
*
* Sets kthread_should_stop() for @k to return true, wakes it, and
* waits for it to exit. This can also be called after kthread_create()
* instead of calling wake_up_process(): the thread will exit without
* calling threadfn().
*
* If threadfn() may call do_exit() itself, the caller must ensure
@hiboma
hiboma / ssh-proxy.py
Created October 30, 2012 10:35
twisted - ssh proxy スケッチ
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
import base64, os, fcntl, tty, struct
from twisted.enterprise import adbapi
@hiboma
hiboma / hoge.rb
Created July 24, 2012 01:28
Quiz - Array methods
# -*- encoding: utf-8 -*-
describe Array do
let(:e) { [1,2,3,4,5] }
it "先頭の要素(1)を返すメソッド" do
e[0].should == 1
e.at(0).should == 1
e.first.should == 1
@hiboma
hiboma / gist:3053847
Created July 5, 2012 14:04
quotes from 詳細Linux Kernel

mknod ってなんだろう?

特殊ファイルを作成する (スペシャルファイル)

スペシャルファイルが何を指すのか分からん

ファイルシステムの分類

ディスクベースのファイルシステム