Thursday, March 22, 2012

SQL TEST

CREATE DATABASE _ ;
CREATE TABLE _._ (_ int(1) not null primary key);
INSERT INTO _._(_) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
SELECT * FROM _._;
DROP TABLE _._ ;
DROP DATABASE _;

--
  = ^ . ^ =

Delete temp files and directories

% while sleep 0.1 ; do if [ $(($RANDOM % 2)) -eq 0 ] ; then rmdir -v `mktemp -d` ; else rm -v `mktemp` ; fi ; done ; 


--
  = ^ . ^ =

Wednesday, March 14, 2012

show my ip address


#!/bin/sh

IP=/bin/ip
SED=/bin/sed
CUT=/usr/bin/cut

IF=en0

if [ ! -z ${1} ]
then
  IF=${1}
fi

$IP addr show dev $IF | $SED -n 3p | $SED -e 's/\ \+/\ /g' -e 's/\/.*$//g' | $CUT -d ' ' -f 3

--
  = ^ . ^ =

Monday, March 5, 2012

IPv4 and IPv6 SOCKS proxy

$ cat Makefile
XTERM=/usr/bin/xterm
SSH=/usr/bin/ssh
GEOMETRY=169x39-0-0
IPv6_LOCALHOST=::1
PROXY_PORT=1080
SSH_PORT?=22
IPv4_PROXY=127.128.129.130
IPv6_PROXY=${IPv6_LOCALHOST}
IPv4_REMOTE?=127.126.125.124
IPv6_REMOTE=${IPv6_LOCALHOST}
IPv4_BIND=127.127.127.127
IPv6_BIND=${IPv6_LOCALHOST}

proxy:
        ${XTERM} -geometry ${GEOMETRY} -iconic -T "IPv4 proxy" \
          -e ${SSH} -v -x -n -N -b $(IPv4_BIND) -p ${SSH_PORT} \
          -D ${IPv4_PROXY}:${PROXY_PORT} ${IPv4_REMOTE} &
        ${XTERM} -geometry ${GEOMETRY} -iconic -T "IPv6 proxy" \
         -e ${SSH} -v -x -n -N -b $(IPv6_BIND) -p ${SSH_PORT} \
         -D [${IPv6_PROXY}]:${PROXY_PORT} ${IPv6_REMOTE} &

$ make proxy

--
  = ^ . ^ =