Skip to content

Instantly share code, notes, and snippets.

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

Naoya Nakazawa n0ts

🏠
Working from home
  • Freelancer
  • Tokyo, Japan
  • X @n0ts
View GitHub Profile
@n0ts
n0ts / twitter_widget_custom.css
Created June 30, 2011 11:12
custom css for twitter widget
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<style type="text/css">
.twtr-hd {
display: none !important;
}
.twtr-bd {
background: #FFFFFF !important;
}
.twtr-ft {
display: none !important;
@n0ts
n0ts / check_snmp_memory
Created July 21, 2011 16:09
check_snmp_memory
#!/bin/bash
# check_snmp_memory
# Description : Checks memory and swap usage on Windows/Linux Server
# Version : 1.8
# Author : Yoann LAMY
# Licence : GPLv2
# Commands
CMD_BASENAME="/bin/basename"
@n0ts
n0ts / tiarra
Created November 28, 2011 04:01
/usr/local/rc.d/tiarra rc script
#!/bin/sh
. /etc/rc.subr
name=tiarra
rcvar=`set_rcvar`
# read settings, set default values
load_rc_config $name
: ${tiarra_enable="NO"}
@n0ts
n0ts / check_aacraid.py
Created December 5, 2011 06:57
check_aacraid.py Patch
http://exchange.nagios.org/index.php?option=com_mtree&task=viewlink&link_id=2087&Itemid=74
--- check-aacraid.py-org 2011-12-05 04:05:38.000000000 +0900
+++ check-aacraid.py 2011-12-05 15:53:10.000000000 +0900
@@ -31,6 +31,7 @@
# v0.2 - checks logical volume status & wipes log
# v0.3 - strips trailing "," & tells you the logical volume with
# the failure
+# v0.4 - fixed c_degraded_re regex pattern
@n0ts
n0ts / kmod-usbrh.spec
Created December 14, 2011 10:52
kmod-usbrh.spec
Source10: kmodtool
%{!?kversion: %define kversion %(uname -r)}
# hint: this can be overridden with "--define kversion foo" on rpmbuild, e.g.
# --define "kversion 2.6.18-128.el5"
%define kmod_name usbrh
%define kverrel %(%{kmodtool} verrel %{?kversion} 2>/dev/null)
%define upvar ""
@n0ts
n0ts / gist:1564950
Created January 5, 2012 11:51
Emacs 起動時間の内訳
;;; ref http://d.hatena.ne.jp/sugyan/20120105/1325756767
load only
init-coding-system: 73 msec
init-flymake: 56 msec
init-highlight: 62 msec
init-dired: 82 msec
init-moccur: 213 msec
init-tramp: 183 msec
init-mmm: 52 msec
@n0ts
n0ts / gist:1593139
Created January 11, 2012 05:06
tcpdump for au phone
3秒タイムアウトする例
14:02:56.474730 IP x.x.x.x.x > y.y.y.y.y.http: S 3761656376:3761656376(0) win 64240 <mss 1460,nop,wscale 0,nop,nop,sackOK>
14:02:56.474886 IP x.x.x.x.http > y.y.y.y.65044: S 190271900:190271900(0) ack 3761656377 win 5840 <mss 1460,nop,nop,sackOK,nop,wscale 9>
14:02:56.486103 IP y.y.y.y.65044 > x.x.x.x.http: . ack 1 win 64240
14:02:59.674876 IP x.x.x.x.http > y.y.y.y.65044: S 190271900:190271900(0) ack 3761656377 win 5840 <mss 1460,nop,nop,sackOK,nop,wscale 9>
14:02:59.686285 IP y.y.y.y.65044 > x.x.x.x.http: . ack 1 win 64240
14:02:59.863439 IP y.y.y.y.65044 > x.x.x.x.http: P 1:1461(1460) ack 1 win 64240
14:02:59.863470 IP x.x.x.x.http > y.y.y.y.65044: . ack 1461 win 18
14:02:59.874930 IP y.y.y.y.65044 > x.x.x.x.http: P 1461:1632(171) ack 1 win 64240
@n0ts
n0ts / gist:2410585
Created April 18, 2012 02:11
/etc/xen/scripts/network-bridge-custom
#!/bin/sh
# Exit if anything goes wrong
set -e
# First arg is operation.
OP=$1
shift
script=/etc/xen/scripts/network-bridge
@n0ts
n0ts / gist:2469378
Created April 23, 2012 07:38
Xen vs KVM UnixBench result
UnixBench
http://code.google.com/p/byte-unixbench/
Xen vs KVM benchmark
OS: CentOS 5.8 x86_64
CPU: 4core
RAM: 8GB
on Hoge-Cloud
UnixBench 5.1.3 Command: ./Run -c 4
@n0ts
n0ts / disable_service_centos5.sh
Created April 25, 2012 01:54
disable service for CentOS 5
#!/bin/sh
disable_service() {
service=$1
/sbin/chkconfig --list $service 2> /dev/null
if [ $? -ne 0 ]; then
return 1
fi
prompt=$2