Wednesday, May 7, 2014

SVN ignore

$ svn propedit svn:ignore .
edit that file like following:
  1 *.out
  2 sftp
  3 sftp-server
  4 ssh
  5 ssh-add
  6 ssh-agent
  7 ssh-keygen
  8 ssh-keyscan
  9 ssh-keysign
 10 ssh-pkcs11-helper
 11 sshd

 12 scp

http://stackoverflow.com/questions/122313/how-do-you-include-exclude-a-certain-type-of-files-under-subversion

Monday, May 5, 2014

Crypto 101

Secret key: Diffie–Hellman, 
Two parties don't know each other can establish a secret key

Alice
Bob
SecretPublicCalculatesSendsCalculatesPublicSecret
apg
p,g\rightarrow

b
apgAga mod p = AA\rightarrow
pgb
apgA
\leftarrow Bgb mod p = BpgABb
aspgABBa mod p = s
Ab mod p = spgABbs

Public-private key: RSA

https://www.cs.utexas.edu/~mitra/honors/soln.html

RSA Algorithm Example

  • Choose p = 3 and q = 11
  • Compute n = p * q = 3 * 11 = 33
  • Compute φ(n) = (p - 1) * (q - 1) = 2 * 10 = 20
  • Choose e such that 1 < e < φ(n) and e and n are coprime. Let e = 7
  • Compute a value for d such that (d * e) % φ(n) = 1. One solution is d = 3 [(3 * 7) % 20 = 1]
  • Public key is (e, n) => (7, 33)
  • Private key is (d, n) => (3, 33)
  • The encryption of m = 2 is c = 27 % 33 = 29
  • The decryption of c = 29 is m = 293 % 33 = 2



Tuesday, April 8, 2014

sudo keeps PYTHONPATH

http://superuser.com/questions/363813/sudo-does-not-preserve-pythonpath


$visudo

Add Defaults env_keep += PYTHONPATH

Add user to the sudo list

$ visudo

It basically use vi to open /etc/sudoers with write permission

Add following:

root    ALL=(ALL) ALL
username  ALL=(ALL) ALL

If you directly open /etc/sudoers using vi, you need to change the file permission and then edit the file. Assume you system setup only read permission for /etc/sudoers

Saturday, February 15, 2014

Send messages to other login users through terminal

$ w
show all of the login users
$ last
show last login users

$ write username
type message
Ctr+D: end of message

Thursday, February 13, 2014

unlock a deny host

1.
$ service denyhosts stop

2.
$ vim /etc/hosts.deny
delete the IP from the file

3.
$ cd /va/lib/denyhosts
$ grep -iRH IP ./*

[root@server denyhosts]# grep -iRH IP ./*
./hosts:IP:0:Sun Feb  9 11:27:57 2014
./hosts-restricted:IP:0:Sun Feb  9 11:27:57 2014
./hosts-root:IP:0:Sun Feb  9 11:27:57 2014
./hosts-valid:IP:11:Sun Feb  9 11:31:57 2014

./users-hosts:username - IP:11:Sun Feb  9 11:31:57 2014

delete the IPs from all of the files. 

4. 
$ service denyhosts start

Tuesday, February 4, 2014

Install svnnotify on CentOS 6

http://pkgs.org/centos-6/repoforge-i386/perl-SVN-Notify-2.80-1.el6.rf.noarch.rpm.html


Install Howto

  1. Download the latest rpmforge-release rpm from
    http://apt.sw.be/redhat/el6/en/i386/rpmforge/RPMS/
  2. Install rpmforge-release rpm:
    # rpm -Uvh rpmforge-release*rpm
  3. Install perl-SVN-Notify rpm package:
    # yum install perl-SVN-Notify
  4. You may have some error message 
Warning: post-commit hook failed (exit code 2) with output:
Use of qw(...) as parentheses is deprecated at /usr/share/perl5/vendor_perl/SVN/Notify.pm line 730.
Can't locate HTML/Entities.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/share/perl5/vendor_perl/SVN/Notify/HTML/ColorDiff.pm line 6.

                Fix it: # yum install perl-HTML-Parser