Showing posts with label trick. Show all posts
Showing posts with label trick. Show all posts

Friday, September 9, 2011

keep in mind

find ./ -name config.php | while read i; do perl -i -ple 's/dodfdfdfsss44/ksfh7sfhlhs8/g' $i ; done

Monday, November 29, 2010

analyze this

my favorite log analyze tool

cat /var/log/apache2/access.log.1 |grep '" 200' | awk '{print $7}' |sort| uniq -c |sort -rn |more

Tuesday, October 19, 2010

my ip from command line

wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'

Thursday, July 9, 2009

ssh tunnels

In many cases, development projects are on the same data center, and the server product is on the other. And often it is necessary to provide the link between the test and product servers.

Simply ssh tunnel:

ssh -p40088 -2 -N -C -f -L 172.11.5.58:3307:10.20.1.103:3306 tunnel@x.x.x.x

-p40088 - gateway to production DC ssh port
172.11.5.58:3307 - host:port on local server
10.20.1.103:3306 - host:port on remote server
tunnel@x.x.x.x - username@host of gateway to production DC


And now when I connect to port 3307 on local server I get connect with 10.20.1.103:3306 on production server.

Monday, July 6, 2009

How to copy directories structure

cd olddir
find . -type d > /tmp/dirlist
cd newdir
for i in `cat /tmp/dirlist` ; do mkdir -p $i ; done

very simply :)