Skip to content

Instantly share code, notes, and snippets.

View hiboma's full-sized avatar

Hiroya Ito hiboma

View GitHub Profile
@hiboma
hiboma / gist:7251089
Last active December 27, 2015 02:19
array_push と [] との比較

array_push と $array[] = $val って何が違うの

  • array_push で配列の要素足すのと、$array[] = $val で配列の要素足すのと何が違うのかわからんので調べた
  • http://pecl.php.net/package/vld を入れると処理系の OPコードを見れる

環境

[vagrant@localhost ~]$ rpm -q php
php-5.3.3-23.el6_4.x86_64

Untitled Slide

Welcome to Glide.

Glide is the easiest way to create useful slide for all of your Gists.

  • input key <- to go backward.
  • input key -> to go forward.

Publishing

@hiboma
hiboma / gist:5857146
Last active December 18, 2015 22:49
running Docker on SL6

Docket SL6 で動かすに当たっていろいろ自分で用意しないといけません

  • aufs 付きカーネル
  • iptables の addrtype
  • go
  • lxc
  • cgroup
  • docker

苦労するだけであまり価値が無い

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
@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