Thursday, December 20, 2012

Remove a passphrase from a private key

  • Remove a passphrase from a private key
    openssl rsa -in privateKey.pem -out newPrivateKey.pem
    
    
    
    
    
    
    This is useful for automation such as auto connect a VPN upon logon. 

Sunday, November 25, 2012

oracle ucm

  • Runs oracle db 11g XE on 10.10.1.158:1521. 
    • sudo /etc/init.d/oracle-xe start
    • netstat -anpt | grep 1521 to verify listener
    • put the following into .bashrc

      • . /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
      • ORACLE_SID=XE
    • sqlplus 
      • use TNS defined in $ORACLE_HOME/network/admin/tnsnames.ora
      • sqlplus system/oracle or sqlplus dev_ocs/oracle 
        • select * from global_name (for db)
        • show user
  • creates a doamin ucm_domain
  • starts wls admin server: startWeblogic.sh
  • starts wls managed server for cs: startManagedLogic.sh UCM_server1 http://localhost:7001/


Friday, November 2, 2012

python for loop, iterator, iterable, generator


For Loop
 When Python executes the for loop, it first invokes the __iter__() method of the container to get the iterator of the container. It then repeatedly calls the next() method (__next__() method in Python 3.x) of the iterator until the iterator raises a StopIteration exception. Once the exception is raised, the for loop ends.

Generators can be thought of as resumable functions


Thursday, October 4, 2012

Solaris 10 cmd

netstat -anf inet -P tcp
netstat -anf inet -P udp

svn merge

Merge trunk to branch


  • Under branch, "svn log -v --stop-on-copy" to find out the last revision number such as 70428
  • Dry run: svn merge --dry-run -r 70428:HEAD https://svn.blah.com//trunk .
  • Real run. 

Wednesday, October 3, 2012

install kivy on ubuntu 12.04


  • sudo apt-get install mesa-common-dev freeglut3-dev
  • pip install cython
  • pip install kivy

Tuesday, September 18, 2012

Wednesday, September 12, 2012

OS X make a bootable flash

hdiutil

iso==> dmg
hdiutil convert -format UDRW -o destination.dmg source.iso

dmg==> usb

sudo dd if=source.dmg of=/dev/rdisk1 bs=1m

Monday, September 10, 2012

OS X Python set up

homebrew

ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
 
install Python from http://www.python.org/getit/mac/

install distribute (easy_install needs it)
wget http://python-distribute.org/distribute_setup.py
$ python distribute_setup.py

install pip,virtualenv 
easy_install pip
pip install virtualenv
pip install virtualenvwrapper

vim .bash_profile
source /virtualenvwrapper.sh

Friday, August 24, 2012

upstart init daemon

Configuration  

/etc/init.conf
/etc/init/*.conf

User Job

$HOME/.init/


Upstart commands


Wednesday, August 22, 2012

mount windows share from Ubuntu


Install

sudo apt-get install smbfs

Inspect

smbclient //test-https.blah.net/ipc$ -U id -Wdomain

mount

sudo mount -t cifs //remote_windows/share $ $HOME/windows -o user=uid,dom=office

Tuesday, August 21, 2012

connect to MS SQL server and Sybase from linux



  • sudo apt-get install unixodbc unixodbc-dev freetds-dev sqsh tdsodbc
  •  cat /etc/freetds/freetds.conf
    •  [tds1]
      host = 10.21.1.1
      port = 1433
      tds version = 7.0
  •  sqsh -S tds1 -U id -P password

Friday, August 17, 2012

browser shortcut with nginx and DNS

OS: Ubuntu

DNS

/etc/hosts
127.0.0.1 foo

Nginx 

in sites-enabled/default

if ( $host = wiki ) {  
   rewrite ^ https://wiki.example.com;
}

Enable SQL server 2012 for TCP

Thursday, August 16, 2012

nmcli without Network Manager GUI

nmcli 

nmcli con down id VPN_CONN_NAME
nmcli con up id VPN_CONN_NAME
nmcli con

automation with nmcli

network-manager restart

sudo service network-manager restart


To automatically connect VPN.

put "nmcli con up id VPN_CONN_NAME" in .profile (upon login)

Friday, August 10, 2012

gevent

installation

  • sudo apt-get install libevent-dev
  • pip install gevent

Wednesday, August 8, 2012

erlang for gaming

concurrency model with Actor



Actor model everything is a Actor, natively concurrent.

Support in programming language 

Erlang: language level. Erlang is the best platform for concurrency and distributed application so far.
Java: library level. Akka

Friday, July 6, 2012

Set up mongodb and cluster

install mongodb

install rock_mongo

  • sudo apt-get install php-pear
  • install php_mongo extension: sudo pecl install mongo
  • configure php_mongo extension: add extension=mongo.so to /etc/php5/apache2/php.ini
  • download rock_mongo and cp -r to /var/www/vhosts/mongo.admin
  • configure dnamasq alias "*admin"now Apache, map a "mongo.admin" to a vhost. 
  • (For Replication web admin) cat /etc/apache2/mods-enabled/vhost_alias.conf
    • set up url rewrite
      RewriteCond %{HTTP_HOST} ^mongo.dev$
      RewriteRule (.*) http://localhost:28017/_replSet
  • sudo service apache2 restart

Saturday, June 30, 2012

Managing services with update-rc.d

removing a service
update-rc.d -f apache2 remove

adding a service
update-rc.d apache2 defaults

Monday, June 25, 2012

Set up Apache2 for SSL

For site "foo"

/etc/apache2/sites-enabled/default-ssl

        SSLEngine on
        SSLCertificateFile    /etc/ssl/foo/foo.crt
        SSLCertificateKeyFile /etc/ssl/foo/foo.key
       SSLCertificateChainFile /etc/ssl/foo/intermediate.pem



get the intermediate certificate: https://search.thawte.com/support/ssl-digital-certificates/index?page=content&id=SO1498

Wednesday, April 18, 2012

Install and Configure mod_jk for Apache2


  • sudo apt-get install libapache2-mod-jk
  • sudo vim /etc/libapache2-mod-jk/workers.properties
    • worker.list=worker1,jk-status
    • worker.jk-status.type=status
  • sudo vim /etc/apache2/mods-available/jk.conf  
  • #Everything under root goes to tomcat
    • JkMount  /share/* worker1
    • JkMount  /share worker1

Monday, April 16, 2012

setup UCM


  • Runs oracle db 11g XE on 10.10.1.158:1521. 
    • sudo /etc/init.d/oracle-xe start
    • netstat -anpt | grep 1521 to verify listener
    • put the following into .bashrc

      • . /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
      • ORACLE_SID=XE
    • sqlplus 
      • use TNS defined in $ORACLE_HOME/network/admin/tnsnames.ora
      • sqlplus system/oracle or sqlplus dev_ocs/oracle 
        • select * from global_name (for db)
        • show user
  • Install instant client: install instant client
  • creates a doamin ucm_domain
  • starts wls admin server: startWeblogic.sh
  • starts wls managed server for cs: startManagedLogic.sh UCM_server1 http://localhost:7001/


Saturday, April 14, 2012

Set up Python for Android development

Python Android
adb cmd example
  • Install android-sdk: 
    • tools:android
    • platform-tools:adb
  • Create an AVD ("android avd") test1. 
  • "emulator avd test1"
  • sudo apt-get install ia32-libs
  • While the above is running, "platform-tools/adb install sl4a_r4.apk"
  • While the above is running, "platform-tools/adb install PythonForAndroid_r4.apk"
  • Use adb for pushing python code for Android testing. 

Monday, April 9, 2012

Kerberos


Ubuntu Reference

Admin the Kerberos
Kerberos
ktadd keytab

Server

The‘kadmin.local’ is intended to run directly on the KDC without any Kerberos authentication. Normal UNIX users cannot execute this command. Executing the kadmin.local command will display the kadmin.local prompt only if you are the root user. 

Client

kinit alfresco/admin@EXAMPLE.COM
klist


Admin
kadmin -p alfresco/admin
klist -ef

Python Kerberso

sudo apt-get install libkrb5-dev
pip install kerberos

Thursday, March 29, 2012

iptables


sudo iptables -F
#sudo iptables -A INPUT -p icmp --icmp-type echo-request -j DROP
sudo iptables -A INPUT -p tcp --dport 8080 ! -s  24.86.126.251 -j DROP
#sudo iptables -A INPUT -p tcp --dport 8080 -m iprange --src-range 24.86.126.251 -j ACCEPT
sudo iptables -L

Configure and test CIFS with Alfresco


1. alfresco-global.properties

## CIFS
cifs.enabled=true
cifs.serverName=server_name
cifs.domain=WORKGROUP
cifs.hostannounce=true
cifs.sessionTimeout=500
cifs.ipv6.enabled=false
#cifs.tcpipSMB.port=1445
#cifs.netBIOSSMB.namePort=1137
#cifs.netBIOSSMB.datagramPort=1138
#cifs.netBIOSSMB.sessionPort=1139
cifs.WINS.autoDetectEnabled=true


2. Run "sudo alfresco " as root so that it can use the default ports. 

3. Test From Windows Explorer to map network drive with user credential. 
    net use X: \\192.168.1.35\Alfresco /usr:admin admin

4. Test from Ubuntu side
https://help.ubuntu.com/community/Samba/SambaClientGuide
 smbclient -U qa1 //108.171.177.147/Alfresco -p 139

Alfresco running as linux service

under id "alfresco" (group alfresco)
ln -s $ALF_HOME/alfresco.sh /etc/init.d/alfresco
update-rc.d alfresco defaults

Reference
http://wiki.alfresco.com/wiki/Installing_Alfresco_on_Ubuntu_7.10

Customize Alfresco email invite for external user

tomcat/shared/classes/alfresco/extension$ cat invite-context.xml 



<beans>
        <bean class="org.alfresco.repo.security.authentication.NameBasedUserNameGenerator" id="nameBasedUserNameGenerator">
                
                <property name="namePattern">
                        <value>%emailAddress%</value>
                </property>

                <property name="userNameLength">
                        <value>10</value>
                </property>
        </bean>
</beans> tomcat/shared/classes/alfresco/extension$ cat invite-context.xml

Saturday, March 24, 2012

ffmpeg ubuntu 11.10


  • sudo apt-get install ffmpeg libavcodec-extra-53
  • Follow http://blog.stevenreid.co.uk/2011/10/25/transcoding-video-iphone/ and http://ubuntuforums.org/showthread.php?t=786095
  • ffmpeg -i source.avi -acodec libfaac -ab 128k -ar 44100 -vcodec mpeg4  -b 1000K -s 640x480 destination.m4v

Tuesday, March 20, 2012

install ec2 API


  • enable multiverse: sudo vi /etc/apt/sources.list
deb http://us.archive.ubuntu.com/ubuntu/ lucid multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ lucid multiverse
deb http://us.archive.ubuntu.com/ubuntu/ lucid-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-updates multiverse

Thursday, March 15, 2012

Alfresco LDAP


alfresco-global.properties
(LDAP)authentication.chain=alfinst:alfrescoNtlm,ldap:ldap1
(AD)authentication.chain=alfinst:alfrescoNtlm,ldap-ad1:ldap-ad

Extension Root
(LDAP)tomcat/shared/classes/alfresco/extension/subsystems/Authentication/ldap-ad/ldap1
(AD)tomcat/shared/classes/alfresco/extension/subsystems/Authentication/ldap-ad/ldap-ad1/ldap-ad-authentication.properties

Alfresco LDAP integration
Alfresco LDAP configuration

Tuesday, March 13, 2012

install lookit ubuntu

sudo add-apt-repository ppa:lookit/ppa
sudo apt-get update
sudo apt-get install lookit

Saturday, March 3, 2012

install LAMP on ubuntu

sudo apt-get install tasksel
sudo tasksel install lamp-server
https://help.ubuntu.com/community/Tasksel

Thursday, February 23, 2012

python eco system setup

python ecosystem


install necessary dev tools
$ sudo apt-get install python-pip
$ sudo pip install --upgrade pip 
$ sudo pip install --upgrade virtualenv 
$ sudo pip install --upgrade virtualenvwrapper  
$ sudo apt-get install git-core mercurial subversion
$ sudo apt-get install python-dev build-essential 
 
install python 
$ sudo apt-get intsall python
$ sudo apt-get intsall python3

 



management of virtualenv

$ mkvirtualenv my_project_venv
$ workon my_project_venv
$ deactivate
$ rmvirtualenv my_project_venv
 
create python3 virtualenv
mkvirtualenv -p /usr/bin/python py3
workon py3
pip install ipython3

Wednesday, January 18, 2012

Fix VirtualBox after kernel upgrade


http://askubuntu.com/questions/71441/virtualbox-ubuntu-11-10-linux-kernel-3-cannot-start-virtual-machine

sudo dkms install virtualbox/4.1.2

sudo /etc/init.d/virtualbox start