Sep 22, 2014

Making CryptoJS's encryption output compatible with PHP mcrypt_decrypt function

Recently, I've encounter a problem when migrating CryptoJS and PHP backend.
In CryptoJS, iv will be assigned automatically if iv is not given. But in PHP, NULL vectors will be used as iv...
So the result generated by CryptoJS cannot be decoded by PHP.
Hence, I've been digging up the solution to overcome this problem....
And the following code segment is what I found and tested.


Feel free to copy this. [ JsFiddle Test ]

BTW, This site can be used to test the encoding result. ( This site uses PHP as its backend... )

Aug 20, 2014

Disabling genome-ssh-askpass

I've encountered an issue trying to pull commits to a remote server by remote controlling via ssh using MacOSX Terminal.

However, the server keeps returning the following error

(gnome-ssh-askpass:18368): Gtk-WARNING **: cannot open display:

The remote server is a linux using gnome desktop environment. But the GUI cannot displayed when using tty mode. So I survey the Internet and found the following solution.

unset SSH_ASKPASS

You can add this line to rc.local or ~/.bash_profile if you wanna disable it forever and ever~

Referenced from:
[Blog @ Codonomics: How to disable gnome-ssh-askpass?]

Mar 10, 2014

Rule of linux kernel's versions

Linux kernel version is constructed by parts [ x.y.z ]
x - main version
y - even number means that the version is stable
z - error patch times

Mar 8, 2014

Modify phpMyAdmin's session timeout duration

Insert the following line into config.inc.php

$cfg['LoginCookieValidity'] = ;

Installing RHEL EPEL Repo on Centos 5.x or 6.x

[ CentOS 5.x ]
wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
sudo rpm -Uvh epel-release-5*.rpm

wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
sudo rpm -Uvh remi-release-5*.rpm


[ CentOS 6.x ]
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -Uvh epel-release-6*.rpm

wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm



remi repo is disabled by default, don't forget to enable it!

Feb 22, 2014

Some stupid keywords....

mod_vhost_alias

git archive

find -regex -exec

$EUID

yum --enablerepo=repo,repo,repo --disablerepo=repo,repo,repo --nogpgcheck

Feb 21, 2014

Yum temporarily disable Key check

yum install --nogpgcheck XXXXXXXXX

Feb 19, 2014

Remove app from Security & Privacy -> Accessibility

sudo sqlite3 /Library/Application\ Support/com.apple.TCC/Tcc.db 'delete from access where client like "%appnamehere%"'

Replace "appnamehere" with the name of the app as it appears in the Accessibility list (keep the % signs).

That's all...

Jan 29, 2014

HTML Vertical Align Middle Techinque

I've been encounter some critical layout structure requirements - Vertical Align Middle.
Luckily, I found a solution on 

In case that I'll need them in the future, I decide to leave myself some breadcrumbs here...

Here's the final example in jsFiddle.
And here's the referenced original post.

And the followings are contents in jsFiddle...