This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yum install glibc-static | |
# yum install ncurses-static | |
LOCALHOME=${HOME}/usr/opt | |
mkdir -p ${LOCALHOME} | |
cd ${LOCALHOME} | |
# Get tmux | |
wget http://downloads.sourceforge.net/tmux/tmux-1.9a.tar.gz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat /vol2/home/bounce/opwv_pac/lg_smpl/log/smtp_smpl_1/smtp_128.stat | sed -E "s/^\t([^\t ]+)(( [^\s]+){0,})\t\s*/\t\1 /; s/ {1,}/ /g;" | sed -E ":a;N;s/\n\t/ /;t a;P;D" | sed -E "s/^(....)(..)(..) (..)(..)(.)..*\) /\1-\2-\3T\4:\5:\60 /; s/[][] ?/ /g;" | |
for f in $(ls *stats); do cat ${f} | sed -E "s/^\t([^\t ]+)(( [^\s]+){0,})\t\s*/\t\1 /; s/ {1,}/ /g;" | sed -E ":a;N;s/\n\t/ /;t a;P;D" | sed -E "s/^(....)(..)(..) (..)(..)(.)..*\) /\1-\2-\3T\4:\5:\60 /; s/[][] ?/ /g;" > ${f}.csv; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In-memory Cassandra-ish thingy... useful for unit tests. Maybe useful for other | |
# stuff too? No support for SuperColumns, but that should be easy enough to add. | |
import bisect | |
import copy | |
from cassandra.ttypes import NotFoundException, Column, ColumnPath, ColumnOrSuperColumn | |
class SSTable(object): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
site packageの場所 | |
``` | |
python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" | |
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
D=${INTERMAIL}/log; diff <(find ${D}/. -type l -exec readlink {} \; | sort | uniq -u) <(find ${D}/. -type f -exec basename {} \; | sort | uniq -u) | sed -n -E 's#^> (.*)$#'${D}'/\1#p' | xargs rm | |
5,15,25,35,45,55 * * * * bash -l -c "~/mxlogdel.sh 2>&1 | logger -t mxlogdel -p local0.info " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tcpdump -i <IF> -G <rotation seconds> -W <rotation num> -w /tmp/tcpdump_%Y%m%d_%H%M%S.cap host <src ip> and host <dst ip> and port <dst port> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo 1 > /proc/sys/net/ipv4/ip_forward | |
smtp_ip='192.168.100.1' | |
smtp_port='25' | |
smtp_port1='12125' | |
smtp_port2='12225' | |
smtp_port3='12325' | |
/sbin/iptables -F | |
/sbin/iptables -t nat -F | |
/sbin/iptables -t mangle -F | |
iptables -t mangle -A PREROUTING -p tcp -d $smtp_ip --dport $smtp_port -m state --state NEW -m statistic --mode nth --every 3 --packet 0 -j CONNMARK --set-mark 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed -e ":a;N;s/\(abc\)\n\(def\)/\1\2/;t a;P;D" | |
sed -e ":a;N;s/\n\([^T].*\) .* in \(.*\)/ \2/;t a;P;D" | sed "s/Thread .* (Thread .* (LWP \(.*\))): \(.*\)/\1 \2/; s/ from [^ ]*\($\| \)/ /g; s/@@GLIBC[^ ]*//g; s/ ()\($\| \)/--/g; s/([^)]*)/()/g; s/ \[[^]]\+\]/\[\]/g; s/<[^<>]*>/<>/g; s/<\([^<>]*<>[^<>]*\)\{1,\}>/<<>>/g; s/<\([^<>]*<<>>[^<>]*\)\{1,\}>/<<<>>>/g; s/<\([^<>]*<<<>>>[^<>]*\)\{1,\}>/<<<<>>>>/g; s/ /-/2g " | awk '{print $2}' | sort | uniq -c | sort -nk1 | |
pstack 26459 | sed -e ":a;N;s/\n\([^T].*\) .* in \(.*\)/ \2/;t a;P;D" | sed "s/Thread .* (Thread .* (LWP \(.*\))): \(.*\)/\1 \2/; s/ from [^ ]*\($\| \)/ /g; s/@@GLIBC[^ ]*//g; s/ ()\($\| \)/--/g; s/([^)]*)/()/g; s/ \[[^]]\+\]/\[\]/g; s/<[^<>]*>/{}/g; s/<[^<>]*>/{}/g; s/<[^<>]*>/{}/g;s/<[^<>]*>/{}/g;s/{}/<>/g; s/ /-/2g " | awk '{print $2}' | | |
sort | uniq -c | sort -nk1 | |
pstack $(pgrep mta) | sed -e ":a;N;s/\n\([^T].*\) .* in \(.*\)/ \2/;t a;P;D" | sed -e "s/Thread .* (Thread .* (LWP \(.*\))): \(.*\)/\1 \2/; s/ from [^ ]*\($\| \)/ /g; s/@@GLIBC[^ ]* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while true ; do echo -e "\033[H\033[J"; ps -A -L -o pid,tid,psr,pcpu,comm= | grep -v PSR | awk '{sum[$3" "$1" "$5]+=$4};END { for (key in sum) {print key,sum[key]}}' | sort -nk1 | column -t | grep -v " 0$" ; sleep 1 ; done | |
while true; do NOW=$(date "+%Y-%m-%dT%H:%M:%S"); ps -A -L -o pid,tid,psr,pcpu,comm= | grep -v PSR | awk '{sum[$3" "$1" "$5]+=$4};END { for (key in sum) {print key,sum[key]}}' | sort -nk1 | column -t | grep -v " 0$" | awk '{ print "'${NOW}'", $0; fflush() }' ; sleep 2 ; echo ; done | |
pidstat -I -u -t -d -p ALL 3 65535 | grep -v -e " 0.00 0.00 0.00 " -e " 0.00 0.00 0.00 0.00 " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# from stackoverflow http://stackoverflow.com/questions/3342889/how-to-measure-separate-cpu-core-usage-for-a-process | |
# Note: These stats are based on process lifetime, not the last X seconds, so | |
# you'll need to restart your process to reset the counter. | |
pids=() | |
while [ $# != 0 ]; do | |
pids=("${pids[@]}" "$1") | |
shift | |
done |