Skip to content

URL Encoding

http://blog.lunatech.com/2009/02/03/what-every-web-developer-must-know-about-url-encoding

://,    ?   &   /  ;   = are special chracter in a URL. So what if fine name contains these characters ???

/   Path

?  Query

at end is Fragment, contains part of the page.

 

Setting up S3

sudo /usr/sbin/alternatives –install /usr/bin/java java /usr/java/jdk1.7.0_10/bin/java 20001 && sudo /usr/sbin/alternatives –config java && java -version

s3cmd -c

/usr/local/etc/.s3cfg-loguploader https://github.com/s3tools/s3cmd

cd s3cmd

python setup.py install

s3cmd –ocnfigure

cloc…. count lines of code

http://cloc.sourceforge.net/

prompt> cloc perl-5.10.0.tar.gz
    4076 text files.
    3883 unique files.                                          
    1521 files ignored.

http://cloc.sourceforge.net v 1.50  T=12.0 s (209.2 files/s, 70472.1 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Perl                          2052         110356         130018         292281
C                              135          18718          22862         140483
C/C++ Header                   147           7650          12093          44042
Bourne Shell                   116           3402           5789          36882
Lisp                             1            684           2242           7515
make                             7            498            473           2044
C++                             10            312            277           2000
XML                             26            231              0           1972
yacc                             2            128             97           1549
YAML                             2              2              0            489
DOS Batch                       11             85             50            322
HTML                             1             19              2             98
-------------------------------------------------------------------------------
SUM:                          2510         142085         173903         529677
-------------------------------------------------------------------------------

prompt> cloc --show-lang

prompt> cloc --diff gcc-4.4.0.tar.bz2 gcc-4.5.0.tar.bz2

prompt> cloc --diff  Python-2.6.6.tar.bz2 Python-2.7.tar.bz2

SSH Tips

— git config –global http.sslVerify false

for x in $(seq 9); do for y in c ; do ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no beacon-00${x}${y}.helo.com ‘df -h /’; done ;done

1) Creating the key

You can create a private/public key pair (in the files ~/.ssh/filename and ~/.ssh/filename.pub) that has no passphrase protecting the private key, by doing the following:

cd ~/.ssh   ;  ssh-keygen -f filename -C ‘Some comment’  -N ” -t  rsa  -q

2)

If on the other hand, you’d like to protect the private key file with a passphrase (which will be needed to be typed at any client that wants to use the key pair):

cd ~/.ssh
   ssh-keygen -f filename -C 'Some comment' -t rsa -q

3) authorized_keys There are a number of things that can be done in an authorized_keys to further 
restrict access. These are all arranged by prefixing the line containing the public key by a single 
"phrase" of comma-separated options (see below for an example of what this winds up looking like) 

a) Host access list

If the options phrase at the beginning of a line contains the keyword from="string" this restricts the use of the key on that line to sessions that originate from hosts that match "string". Examples might be

   from="trusted.eng.cam.ac.uk"
   from="*.eng.cam.ac.uk,!untrusted.eng.cam.ac.uk"
   from="tw?00.eng.cam.ac.uk"

 b) Forced command

If the options phrase at the beginning of a line contains the keyword command="string", then any ssh connection that authenticates using that particular key will only run the command specified, even if the command line it was given specified another command.

Other options

Various ssh facilities may be suppressed by adding the following options to the options phrase at the beginning of a line:

no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty

Example authorized_keys file

This example file has two entries. Note that there is no whitespace in the list of options; they are separated by commas, and strings are double-quoted (eg in the argument to from=).

#
# comments are ignored in authorized_keys files
#
from="trusted.eng.cam.ac.uk",no-port-forwarding,no-pty ssh-rsa AAAAB
3NzaC1yc2EAAAABIwAAAQEAybmcqaU/Xos/GhYCzkV+kDsK8+A5OjaK5WgLMqmu38aPo
56Od10RQ3EiB42DjRVY8trXS1NH4jbURQPERr2LHCCYq6tHJYfJNhUX/COwHs+ozNPE8
3CYDhK4AhabahnltFE5ZbefwXW4FoKOO+n8AdDfSXOazpPas8jXi5bEwNf7heZT++a/Q
xbu9JHF1huThuDuxOtIWl07G+tKqzggFVknM5CoJCFxaik91lNGgu2OTKfY94c/ieETO
XE5L+fVrbtOh7DTFMjIYAWNxy4tlMR/59UVw5dapAxH9J2lZglkj0w0LwFI+7hZu9XvN
fMKMKg+ERAz9XHYH3608RL1RQ== This comment describes key #1
# 
# this one should be restricted so that only machines with hostnames
# matching *.eng.cam.ac.uk can use it.
# 
from="*.eng.cam.ac.uk",no-X11-forwarding,noagent-forwarding ssh-rsa 
AAAAC4MybC1yc2EAAAABIwAAAQEAybmcqaU/Xos/GhYCzkV+kDsK8+A5OjaK5WgLMqm
u38aPo56Od10RQ3EiB42DjRVY8trXS1NH4jbURQPERr2LHCCYq6tHJYfJNhUX/COwHs
+ozNPE83CYDhK4AhabahnltFE5ZbefwXW4FoKOO+n8AdDfSXOazpPas8jXi5bENf7he
ZT++a/Qxbu9JHF1huThuDuxOtIWl07G+tKqzggFVknM5CoJCFxaik91lNGgu2OTKfY9
4c/ieETOXE5L+fVrbtOh7DTFMjIYAWNxy4tlMR/59UVw5dapAxH9J2lZglkj0w0LwFI
+7hZu9XvNfMKMKg+ERAz9XHYH3608RL1RQ== This comment describes key #2

Possible Issues ::::

1) Wrong keys

First, check that you really have put the matching public key in the ~/.ssh/authorized_keys file on the machine you’re trying to connect to, and that you’re telling your ssh client about the correct private key using the -i argument.

Keys the wrong way round

The public key goes in the destination host’s ~/.ssh/authorized_keys file.

The private key is needed on the machine you’re running ssh or slogin from.

2) File permissions

3) Wrong ssh protocol version :::

Sometimes, however, they’ll both decide to prefer v1.5 even though they both support v2. In such cases, your ssh-rsa key (which is v2 compliant) won’t work.

Solution: Force v2 by using the -2 flag to ssh or slogin

ssh -2 -i ~/.ssh/my_private_key remotemachine

4) failure to use the right authentication mechanisms

The client can be configured to request particular authentication mechanisms in a particular order. A non-standard local configuration file can therefore potentially lead the client to prompt for a password before in a particular ordera successful keybased authentication can occur.

The following options passed to ssh or slogin should compel the client to only offer/try the key-based authentication mechanism only:

   ssh -2 -i ~/.ssh/my_private_key \
       -o 'PasswordAuthentication no' \
       -o 'ChallengeResponseAuthentication no' \
       -o 'PreferredAuthentications publickey' \
       remotemachine

This may be a useful way of minimising the chances of an entirely autonomous ssh-based command execution failing due to attempting a user interaction.

 SSH-Agent  ::::
the ssh-agent daemon exists to store decrypted private-keys you plan on using in a given session. The thing most people get tripped up on when using ssh-agent is that what the program outputs, some borne or csh shell commands, needs to be run. It may look like ssh-agent has set some variables for you, but it has in fact done no such thing. If you call 
ssh-add  
without processing 
ssh-agent’s     output, it will complain it is unable to open a connection to your authentication agent. The most straightforward way to run ssh-agent on the command line is as follows: 
eval `ssh-agent`. 
After doing this, calls to ssh-add should succeed without error.

Usable Scripts

3) nohup find . -type f -not -name “*.gz” -exec gzip -vf {} \; &,    du -ks * | sort -n

1) $ cat nrpe_restart
#/bin/bash
for i in $@
do
ssh -o StrictHostKeyChecking=no $i -t sudo /etc/init.d/nrpe-server restart
done

2) for NAME in Rajesh Yug Manzoor

do

ADDRESS=”$NAME@example.com”

MESSAGE=’Proj r due today!!!!’

echo $MESSAGE |  mail -s Reminder $ADDRESS

done

3) for n in {1…20}; do

host=192.168.0.$n

ping -c2 $host &> /dev/null

if [ $? = 0 ]; then

echo “” $host is up””

else

echo “$host is down”

fi

done

++++++++++++++++++

SSH Aliases   In ~/.ssh/config

host foo bar
hostname %h.domain.name
username webadmin
and then ssh foo will turn into webadmin@foo.domain.name while ssh bar will turn into webadmin@bar.domain.name

JPS Java Process Status tool | Hyper threading (HT)

Hyper-threading (officially Hyper-Threading Technology or HT Technology, abbreviated HTT or HT) is Intel’s proprietary simultaneous multithreading (SMT) implementation used to improve parallelization of computations (doing multiple tasks at once) performed on PC microprocessors. It first appeared in February 2002 on Xeon server processors and in November 2002 on Pentium 4 desktop CPUs.[1] Later, Intel included this technology in Itanium, Atom, and Core ‘i’ Series CPUs, among others.
Hyper-threading works by duplicating certain sections of the processor—those that store the architectural state—but not duplicating the main execution resources. This allows a hyper-threading processor to appear as the usual “physical” processor and an extra “logical” processor to the host operating system (legacy operating systems see two “physical” processors), allowing the operating system to schedule two threads or processes simultaneously and appropriately. When execution resources would not be used by the current task in a processor without hyper-threading, and especially when the processor is stalled, a hyper-threading equipped processor can use those execution resources to execute another scheduled task. (The processor may stall due to a cache miss, branch misprediction, or data dependency.)
JPS:::::
Important Options::
-q
Suppress the output of the class name, JAR file name, and arguments passed to the main method, producing only a list of local VM identifiers.
-m
Output the arguments passed to the main method. The output may be null for embedded JVMs.
-l
Output the full package name for the application’s main class or the full path name to the application’s JAR file.
sudo jps -l
16390 org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode
27490 sun.tools.jps.Jps
20889 org.apache.hadoop.mapred.TaskTracker
21629 org.apache.hadoop.hdfs.server.datanode.DataNode
15476
24129 org.apache.zookeeper.server.quorum.QuorumPeerMain
-v
Output the arguments passed to the JVM.
 sudo jps  -v
16390 SecondaryNameNode -Dproc_secondarynamenode -Xmx1000m -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote -Dhadoop.log.dir=/home/hdfs/logs g -Dhadoop.home.dir=/usr/lib/hadoop-0.20 -Dhadoop.id.str=hadoop -Dhadoop.root.logger=INFO,DRFA -Djava.library.path=/usr/lib/hadoop-0.20/lib/native/Linux-amd64-64 -Dhadoop.policy.file=hadoop-policy.xml
-V
Output the arguments passed to the JVM through the flags file (the .hotspotrc file or the file specified by the -XX:Flags=<filename> argument).

UseFull Blogs and Books

https://noggin.intel.com/sites/default/files/Intel-Recommended-Reading-List_1H14_0.pdf
http://resrc.io/list/10/list-of-free-programming-books/
http://www.reactivemanifesto.org/

http://blogs.atlassian.com/2013/09/do-you-know-cassandra/
http://www.trottercashion.com/2012/05/02/creating-aws-identity-and-access-management-signing-certificates.html
1) http://flossstuff.wordpress.com/    Ankur aggarwal

2) balajirajan.com or http://rbalajee.wordpress.com/

3) http://serverxpert.blogspot.in/ Avinash

5) http://www.cloudmurali.com

6) http://bradhedlund.com/2011/09/10/understanding-hadoop-clusters-and-the-network/

7) http://29aug.blogspot.in/ Soumya Ranjan

http://www.geeksww.com/tutorials/operating_systems/linux/tips_and_tricks/some_tricks_used_by_the_linux_kernel.php

Cyber Attacks

1) Device Evasions. 

a) Router Evasion–> route hijacking,

b) FIrewall Evasion –> Firewall request Spoffing, Firewall DoS, pkt Forging, Rule Exploitation.

c) IDS and Switch Evasion