Skip to content

Instantly share code, notes, and snippets.

View pichuang's full-sized avatar

Phil Huang pichuang

View GitHub Profile
@pichuang
pichuang / oom_killer_score.sh
Created June 10, 2014 13:44
Display oom_killer all process oom_score
#!/bin/bash
for proc in $(find /proc -maxdepth 1 -regex '/proc/[0-9]+'); do
printf "%2d %5d %s\n" \
"$(cat $proc/oom_score)" \
"$(basename $proc)" \
"$(cat $proc/cmdline | tr '\0' ' ' | head -c 50)"
done 2>/dev/null | sort -nr | head -n 10
@pichuang
pichuang / Support_auto_mysql_secure_installation.patch
Last active August 29, 2015 14:02
auto_mysql_secure_installation.patch
# Maintainer: Roan Huang <pichuang@cs.nctu.edu.tw>
Automating mysql_secure_installation
In this patch, MySQL default password is "ARCHLNMP"
default password is NOT safe to your system, Please use
/usr/bin/mysqladmin -u root -p'ARCHLNMP' password 'YOUR_NEW_PASSWORD'
@pichuang
pichuang / auto_ssh_agent
Created June 12, 2014 14:06
Auto load ssh_key
#Auto load ssh_key & ssh-agent
#Add ~/.bashrc
if [ -z "$SSH_AUTH_SOCK" ] ; then
eval `ssh-agent -s` > /dev/null 2>&1
ls ~/.ssh/ |grep -vE '(.pub|authorized_keys|known_hosts)'| xargs -i ssh-add ~/.ssh/{} > /dev/null 2>&1
fi
@pichuang
pichuang / python_switch
Created June 29, 2014 00:54
python2 python3 switch for archlinux or others
#!/bin/bash
VERSION=$1
if [ "python2" == "$VERSION" ] || [ "python3" == "$VERSION" ]
then
cd /usr/bin/
ln -sfn $VERSION python
echo "switch to $VERSION"
else
@pichuang
pichuang / openwrt-add-libatomic.patch
Created July 1, 2014 08:48
OpenWrt Support libatomic patch
#Signed-off-by: Tobias Steinicke <tobias.steinicke at inet.tu-berlin.de>
#https://lists.openwrt.org/pipermail/openwrt-devel/2014-March/024286.html
--- a/package/libs/toolchain/Makefile 2014-07-01 16:33:40.734903000 +0800
+++ b/package/libs/toolchain/Makefile 2014-07-01 15:02:10.730903000 +0800
@@ -52,6 +52,31 @@
endmenu
endef
+define Package/libatomic
@echo off
whoami /groups |find "S-1-16-12288"
if %errorlevel%==1 goto nouac
bcdedit.exe /enum %GUID_ORIG% /v |find "win7.vhd"
if %errorlevel%==1 goto vhd
bcdedit /set %GUID_ORIG% device vhd=[D:]\diff1.vhd
bcdedit /set %GUID_ORIG% osdevice vhd=[D:]\diff1.vhd
bcdedit /default %GUID%
bcdedit /export d:\boot\BCDMALLI.bcd
attrib -r d:\tausta.jpg
@pichuang
pichuang / hidden_flow
Created July 17, 2014 20:17
About OpenvSwitch Hidden Flow
duration=4s, n_packets=0, n_bytes=0, priority=180007,tcp,nw_dst=140.113.215.6,tp_dst=6633,actions=NORMAL
duration=4s, n_packets=0, n_bytes=0, priority=180000,udp,in_port=LOCAL,dl_src=86:4f:ae:44:14:40,tp_src=68,tp_dst=67,actions=NORMAL
duration=4s, n_packets=0, n_bytes=0, priority=180008,tcp,nw_src=140.113.215.6,tp_src=6633,actions=NORMAL
duration=4s, n_packets=0, n_bytes=0, priority=180003,arp,dl_dst=00:1c:42:00:00:18,arp_op=2,actions=NORMAL
duration=4s, n_packets=0, n_bytes=0, priority=180001,arp,dl_dst=86:4f:ae:44:14:40,arp_op=2,actions=NORMAL
duration=4s, n_packets=0, n_bytes=0, priority=180006,arp,arp_spa=140.113.215.6,arp_op=1,actions=NORMAL
duration=4s, n_packets=0, n_bytes=0, priority=180005,arp,arp_tpa=140.113.215.6,arp_op=2,actions=NORMAL
duration=4s, n_packets=0, n_bytes=0, priority=180004,arp,dl_src=00:1c:42:00:00:18,arp_op=1,actions=NORMAL
duration=4s, n_packets=0, n_bytes=0, priority=180002,arp,dl_src=86:4f:ae:44:14:40,arp_op=1,actions=NORMAL
table_id=254, duration=674s, n_packets=0, n_bytes=0,
PORTNAME= php5
PORTVERSION= 0.5
PORTREVISION= 1
CATEGORIES= cs
MASTER_SITES= # none
PKGNAMESUFFIX= -extensions
DISTFILES= # none
EXTRACT_ONLY= # none
@pichuang
pichuang / vswitch.ovsschema
Created August 6, 2014 01:47
vswitch.ovsschema json file
{"name": "Open_vSwitch",
"version": "6.11.3",
"cksum": "2234602985 17310",
"tables": {
"Open_vSwitch": {
"columns": {
"bridges": {
"type": {"key": {"type": "uuid",
"refTable": "Bridge"},
"min": 0, "max": "unlimited"}},
@pichuang
pichuang / upgrade_ovs_in_mininet.sh
Last active August 26, 2021 16:39
Installing new version of Open vSwitch 2.3.0 use Mininet
#!/bin/sh -ev
# Reference: https://github.com/mininet/mininet/wiki/Installing-new-version-of-Open-vSwitch
# How to test: ovs-vsctl -V
# Check permission
test $(id -u) -ne 0 && echo "This script must be run as root" && exit 0
#Remove old version ovs
aptitude remove openvswitch-common openvswitch-datapath-dkms openvswitch-controller openvswitch-pki openvswitch-switch -y