ugly rename hack 
find -name 'Pic*' -exec sh -c 'mv $1 "$(echo $1 | sed s/\\./_/g | sed s/^_/\\./g | sed s/_-//g)"' {} {} \;

[ view entry ] ( 874 views )   |  print article
atomic ops in c with help of gcc 
atomic.h Read More...

[ view entry ] ( 932 views )   |  print article
find PCs in a network 
for i in $(seq 2 254); do ping -c 1 192.168.0.$i | grep -q rtt && echo "found 192.168.0.$i"; done

[ view entry ] ( 752 views )   |  print article
bash network calculation 
IP='130.10.10.10'
NETMASK='255.255.252.0'

l="${IP%.*}";r="${IP#*.}";n="${NETMASK%.*}";m="${NETMASK#*.}"

SUBNET=$((${IP%%.*}&${NETMASK%%.*})).\
$((${r%%.*}&${m%%.*})).\
$((${l##*.}&${n##*.})).\
$((${IP##*.}&${NETMASK##*.}))

l="${SUBNET%.*}";r="${SUBNET#*.}"

BROADCAST=$((${SUBNET%%.*}|256+~${NETMASK%%.*})).\
$((${r%%.*}|256+~${m%%.*})).\
$((${l##*.}|256+~${n##*.})).\
$((${SUBNET##*.}|256+~${NETMASK##*.}))
SUBNET is 130.10.8.0
BROADCAST is 130.10.11.255

[ view entry ] ( 700 views )   |  print article
date with unix timestamp 
date in unix timestamp: date +%s

convert unix timestamp to date: date --date "Jan 1, 1970 00:00:00 +0000 + $1 seconds"

set date with unix timestamp: date -s "Jan 1, 1970 00:00:00 +0000 + $1 seconds"


[ view entry ] ( 754 views )   |  print article

<<First <Back | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Next> Last>>