Skip to content

Instantly share code, notes, and snippets.

@x2c3z4
x2c3z4 / SpeedTest.sh
Last active April 8, 2016 02:33
Get the access speed of build server
curl -JOL https://build-servers.us.oracle.com/app/index.gsp\?offset\=0\&sort\=site.code\&statusId\=all\&order\=asc\&max\=10\&format\=csv\&extension\=csv
cat servers.csv | cut -d, -f3 | grep -v "@" | grep "^\"" | grep "oracle.com" | sed 's/"//g' | while read domain;do elasp=`ping -c 1 $domain 2>/dev/null | grep -o " time=.* ms" | egrep -o "[0-9]{1,4}"`;[[ -n $elasp ]] && echo "$domain $elasp";done | sort -k2 | tee xxx.log
@x2c3z4
x2c3z4 / parse-tcpdump-udp-port-53.php
Created March 21, 2016 18:20 — forked from jtai/parse-tcpdump-udp-port-53.php
Quick and dirty script to parse output of /usr/sbin/tcpdump -vvv -s 0 -l port 53
<?php
// quick and dirty argument parsing
foreach ($argv as $arg) {
if ($arg == '-f') {
define('FOLLOW', true);
}
if ($arg == '-h') {
define('HISTOGRAM', true);
}
name=klog
zonecfg -z $name create -t SYSsolaris-kz
zoneadm -z $name install
zoneadm -z $name boot
zlogin -C $name

The overall structure of an iSCSI PDU is as follows:

Byte/ 0 | 1 | 2 | 3 | / | | | | |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| +---------------+---------------+---------------+---------------+ 0/ Basic Header Segment (BHS) / +/ / +---------------+---------------+---------------+---------------+ 48/ Additional Header Segment 1 (AHS) (optional) /

#!/bin/bash
#
# Routes that we want to be used by the VPN link
ROUTES="10.0.0.0/8 162.73.0.0/16"
# Helpers to create dotted-quad netmask strings.
MASKS[1]="128.0.0.0"
MASKS[2]="192.0.0.0"
MASKS[3]="224.0.0.0"
@x2c3z4
x2c3z4 / signal.c
Created March 10, 2016 04:53 — forked from aspyct/signal.c
Unix signal handling example in C, SIGINT, SIGALRM, SIGHUP...
/**
* More info?
* [email protected]
* http://aspyct.org
* @aspyct (twitter)
*
* Hope it helps :)
*/
#include <stdio.h>
mproxy curl http://www.capitalmuseum.org.cn/capitalmuseum/wsyy/wsyy.jsp | grep -A1 '<td align="center">' | grep -v '<' | grep -v '-' | grep -v -e '^[[:space:]]*$' | sed 's/[[:space:]]*//g'
@x2c3z4
x2c3z4 / solaris.sh
Last active February 24, 2016 07:35
pkg unset-publisher solaris;pkg set-publisher -Pg http://pkg801.cn.oracle.com/s12 solaris
pkg install target
svcadm enable -r svc:/network/iscsi/target:default
itadm create-target
cnt=300
for i in `seq 1 $cnt`;do
v=iscsi-$i
echo "creating $v ..."
zfs create -V 1M rpool/$v
mylu=`stmfadm create-lu /dev/zvol/rdsk/rpool/$v | sed 's/.*: //g'`
i=klog
build=96
vcpu=8
vmem=16G
size=20G
ldm add-vsw net-dev=net0 primary-vsw0 primary
ldm add-vds primary-vds0 primary
ldm add-vcc port-range=5000-5100 primary-vcc0 primary
ldm remove-vcpu $vcpu primary