Tikejhya: Ashish Nepal

Knowledgebase

Month: September 2014 (Page 1 of 2)

Apache allow deny x-forwarded

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.


SetEnvIf X-Forwarded-For ^82.153.192. proxy_env
Order Deny,Allow
Deny from All
Allow from env=proxy_env

running as diff user

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

runuser -l user

testing odbc connection

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

isql -v mydsn myusername mypassword

postfix fight:spam

smtpd_recepient_restrictions = check_client_access cidr:/etc/postfix/blacklist.cidr

/etc/postfix/blacklist.cidr
192.168.0/24 REJECT Go away
postmap /etc/postfix/blacklist.cidr

body_checks=pcre:/etc/postfix/body_checks.pcre

/Viagra/ REJECT Go away

bash: set with variables inside file

sed -i "s#string-to-change.#${replacestring}#g" file.txt

crontab or shell script trailing with ^M

you might occasionally endup with scripts or cronjobs with trailing ^M and would like to quickly check if its so.

I use:

crontab -l | cat -tve

dstat

Options:

dstat [-afv] [options..] [delay [count]]

Dstat allows you to view all of your system resources instantly, you can eg. compare disk usage in combination with interrupts from your IDE controller, or compare the network bandwidth numbers directly with the disk throughput (in the same interval).

Best usages
dstat -cdgilmnprstTy --socket

find uninterruptible or dreaded process

D uninterruptible sleep (usually causing IO)

watch -n 1 "(ps aux | awk '$8 ~ /D/ { print $0 }')"

bash sort decending order

sort --version-sort

Or you can also use:

-b, –ignore-leading-blanks
ignore leading blanks

-g, –general-numeric-sort
compare according to general numerical value

-n, –numeric-sort
compare according to string numerical value

sort -g

delete history & exit

unset HISTFILE && exit

cat /dev/null > ~/.bash_history && history -c && exit

Page 1 of 2

Powered by WordPress & Theme by Anders Norén