Apr 23, 2014
Technology###Installation
On ArchLinux, Install xampp via Yaourt:
yaourt xampp
After installation, you will find the default xampp located in “/opt/lampp”. Start/Stop/Restart the xampp via:
/opt/lampp/lampp start/stop/restart
###Adjustment
Enable the security via:
/opt/lampp/lampp security
Then you have to use username and password for accessing “http://localhost”, the default username is lampp, password is what you selected.
If you want to add your own Directory, add following lines into “/opt/lampp/etc/httpd.conf:
# Add our own Directory
#<Directory "/yourDirectory/">
<Directory "/home/Trusty/code/octo/heroku/Tomcat/public/">
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Require all granted
</Directory>
To enable virtualhost, you have to uncomment following line in “/opt/lampp/etc/httpd.conf:
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
Then we should edit the etc/extra/httpd-xampp.conf
, to change the security issue:
#
# New XAMPP security concept
#
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
Order deny,allow
Deny from all
#Allow from ::1 127.0.0.0/8 \
# fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \
# fe80::/10 169.254.0.0/16
Allow from ::1 127.0.0.0/8
Allow from all
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
Add more vhosts, the definition is located at /opt/lampp/etc/extra/httpd-vhosts.conf:
<VirtualHost *:80>
DocumentRoot /opt/lampp/htdocs
ServerName localhost
ServerAlias www.localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/home/Trusty/code/octo/heroku/Tomcat/public/"
ServerName localhost2
ServerAlias www.localhost2
<Directory "/home/Trusty/code/octo/heroku/Tomcat/public/">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Add the definition of hostname in /etc/hosts:
127.0.0.1 localhost2.localdomain localhost2
127.0.0.1 localhosts # for blog using in XAMPP
###Configuration
Add the xampp into the startup procedure, in .xinitrc:
sudo /opt/lampp/lampp start &
Then everytime the lampp will automatically start.
Add systemd startup
Configure the systemd startup script via following commands:
$ pwd
/etc/systemd/system
$ cat xampp.service
[Unit]
Description=xampp for ArchLinux, locate in /opt/lampp
After=network.target
[Service]
ExecStart=/opt/lampp/lampp start
ExecStop=/opt/lampp/lampp stop
Type=forking
[Install]
WantedBy=multi-user.target
Enable auto-start xampp.service by default:
# systemctl start xampp.service
# systemctl enable xampp.service
ln -s '/etc/systemd/system/xampp.service' '/etc/systemd/system/multi-user.target.wants/xampp.service'
# ps -ef | grep http
Apr 22, 2014
TechnologyFirst, download the ScreenSavers hacker form:
http://www.mobileread.com/forums/showthread.php?t=88004
And unzip this file, copy the “Update_ss_0.43.N_dxg_install.bin” to the root directory of Kindle.
Then In kindle, [HOME] -> [MENU] > Settings -> [MENU] > Update Your Kindle. The DXG will automatically reboot.
Now mount the DXG into your computer, touch the “last” file under the linkss folder, as:
[root@XXXyyy mnt]# cd linkss/
[root@XXXyyy linkss]# ls
auto backups cover_cache info.txt overflow screensavers
autoreboot bin etc mounted_824x1200 run
[root@XXXyyy linkss]# touch last
Now reboot your Kindle Again, your Kindle will remain the last read page as the ScreenSaver.
Apr 22, 2014
Technology###View Git LOG
git log for view your activities:
$ git log --pretty=oneline
1f7ec5eaa8f37c2770dae3b984c55a1531fcc9e7 Added a comment
582495ae59ca91bca156a3372a72f88f6261698b Added a default value
323e28d99a07d404c04f27eb6e415d4b8ab1d615 Using ARGV
94164160adf8faa3119b409fcfcd13d0a0eb8020 First Commit
git log controlling items:
$ git log --pretty=oneline --max-count=2
$ git log --pretty=oneline --since='5 minutes ago'
$ git log --pretty=oneline --until='5 minutes ago'
$ git log --pretty=oneline --author=<your name>
$ git log --pretty=oneline --all
try man git-log for more details.
For searching last 7 days’ modification:
$ git log –all –pretty=format:'%h %cd %s (%an)’ –since='7 days ago’
Final command:
$ git log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short'
$ git log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
* 1f7ec5e 2013-04-13 | Added a comment (HEAD, master) [Jim Weirich]
* 582495a 2013-04-13 | Added a default value [Jim Weirich]
* 323e28d 2013-04-13 | Using ARGV [Jim Weirich]
* 9416416 2013-04-13 | First Commit [Jim Weirich]
Explanation:
--pretty="..." 定义输出的格式
%h 是提交 hash 的缩写
%d 是提交的装饰(如分支头或标签)
%ad 是创作日期
%s 是注释
%an 是作者姓名
--graph 使用 ASCII 图形布局显示提交树
--date=short 保留日期格式更好且更短
Other tools: gitx (Mac) 和 gitk (任意平台) 在浏览日志历史时十分有用。
###Add Git TAG
Add tag for the specified release: “git tag v1-data”, “git tag” to view all of the tags.
Revert the change via;
git revert HEAD
这将带你到编辑器中。你可以编辑默认的提交信息,或直接 离开它。保存并关闭文件。Or Using the following with no editing:
$ git revert HEAD --no-edit
Using tag for reverting the changes:
$ git tag oops
$ git reset --hard v1
$ git tag -d oops
More than one modification but commit once:
$ git add hello.rb
$ git commit --amend -m "Add an author/email comment"
Change the directory structure:
git mv hello.rb lib
git commit -m "Moved hello.rb to lib"
View the directory tree:
git cat-file -p 4ee1119fb7519dc8298fe5d8e9329f52566afaed
###Merge
Merge the branch with master:
git merge master
when conflicts happens, you will manually merge it.
Revert to specified version:
git reset --hard <hash>
Clone the remote repository to local, using git clone:
$ git clone hello cloned_hello
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/greet
remotes/origin/master
git fetch 命令的结果将从远程仓库取得新的提交,但它不会将这些提交合并到本地分支中。If we wnat to sync, then try following:
[Trusty@~/code/git_learn/git_tutorial/cloned_hello]$ git merge origin/master
Updating 5de15b7..105a3d0
Fast-forward
README | 1 +
1 file changed, 1 insertion(+)
[Trusty@~/code/git_learn/git_tutorial/cloned_hello]$ cat README
This is the Hello World example from the git tutorial.
(Changed in original)
Clone the directory structure, mainly for backup:
$ git clone --bare hello hello.git
Cloning into bare repository hello.git...
done.
$ ls hello.git
HEAD
config
description
hooks
info
objects
packed-refs
refs
If we want to push changes to the remote, just git push.
迅速跳过克隆仓库,且让我们拉下刚才推送到共享仓库的更改。
$ cd ../cloned_hello
$ git remote add shared ../hello.git
$ git branch --track shared master
$ git pull shared master
$ cat README
###On Daemon
####启动 Git 服务器
# (From the work directory)
$ git daemon --verbose --export-all --base-path=.
现在,在分开的终端窗口中,转到你的工作目录。
# (From the work directory)
$ git clone git://localhost/hello.git network_hello
$ cd network_hello
$ ls
你应当看到 hello 项目的拷贝。
####推送到 Git daemon
如果你想要推送到 Git daemon 仓库,添加 –enable=receive-pack 到 git daemon 命令。小心,因为此服务器没有授权,任何人 都能推送到你的仓库。
Apr 18, 2014
TechnologyInstall xampp in ArchLinux via:
yaourt xampp
pacman -U xampp-1.8.1-1-x86_64.pkg.tar.xz
Stop and disable the previous installed service:
systemctl stop httpd.service
systemctl stop mysqld
systemctl stop vsftpd
systemctl disable httpd.service
systemctl disable mysqld
systemctl disable vsftpd
Start the xampp via:
/opt/lampp/lampp start
Other commands: start/restart/stop.
Apr 16, 2014
TechnologyUse udisk/udisk2/udiskie for automatically mount usb disks.
pacman -S udisk udisk2 udiskie
Add following line into the .xinitrc:
udiskie -2 --tray &
If you want to umount all media with the command:
udiskie-umount -a
umount speicified disk partition:
udiskie-umount /media/MY_USB_DRIVE