Customize Awesome

###Wallpaper Setting When switching to big display in awesome, the desktop background will not fill the whole screen, thus we need to automatically set the background when we execute the ./singleview script, ./singleview script is a script which I wrote for switching to big display. Listed as following:

killall conky
xrandr --output LVDS1 --off
xrandr --newmode $(gtf 1680 1050 60 | grep Modeline | sed s/Modeline\ // | tr -d '"')
xrandr --addmode VGA1 1680x1050_60.00
xrandr --output VGA1 --mode 1680x1050_60.00 
xscreensaver -nosplash &
xset -b
xmodmap -e "pointer = 3 2 1"
fcitx &
sleep 4
###Add bluetooth
pactl load-module module-alsa-sink device=btheadset 
pacmd load_module module-bluetooth-discover
###Set Background
feh --bg-scale /home/Trusty/document/water.jpg

The last line is the newly-added one which is used for re-setting the background wallpaper.
###Conky Background Setting But when you set the background, your conky will become ugly, just like following picture:
/images/nobg.jpg

So you need to set the ~/.conky.rc, add following lines:

own_window yes
own_window_colour 41A834
TEXT
......
${image  /home/Trusty/document/greenleaf2.jpg  -p 0,0 -s 300x540}

The “own_window yes” could be commented.
So now you got conky looks like following:
/images/goodbg.jpg

Customize Awesome Startup Application

Let applications automatically start at boot will greatly save your time in configurating the system. Following is some tips on how to automatically start applications in awesome desktop environment.
###Xinit Way My startup configuration is listed as:

export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"
exec awesome

So the awesome environment will be started.
###Awesome Way Run only once in awesome desktop, via following configuration file:

function run_once(cmd)
  findme = cmd
  firstspace = cmd:find(" ")
  if firstspace then
    findme = cmd:sub(0, firstspace-1)
  end
  awful.util.spawn_with_shell("pgrep -u $USER -x " .. findme .. " > /dev/null || (" .. cmd .. ")")
end

run_once("udiskie -2 --tray")
run_once("wicd-client --tray")

Add the code into ~/.config/awesome/rc.lua, then you can get the udiskie and wicd-client icon in the tray.
###Change View Way

#dualview
killall conky
xrandr --output LVDS1 --mode 1366x768
xrandr --newmode $(gtf 1920 1080 60 | grep Modeline | sed s/Modeline\ // | tr -d '"')
xrandr --addmode VGA1 1920x1080_60.00
xrandr --output VGA1 --mode 1920x1080_60.00 --right-of LVDS1
xscreensaver -nosplash &
xset -b
xmodmap -e "pointer = 3 2 1"
fcitx &
sleep 2
sudo whatpulse &
conky &


###Systemd Way For example, we want to enable xampp.service on every start:

[root@DashArch system]# pwd
/etc/systemd/system
[root@DashArch 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

Then we can start/stop the service, enable/disable the service via:

systemctl start xampp.service
systemctl stop xampp.service
systemctl enable xampp.service

Qemu emulated kali

###Preparation Create the image file:

$ qemu-img create -f qcow2 kali.qcow2 20G
Formatting 'kali.qcow2', fmt=qcow2 size=21474836480 encryption=off cluster_size=65536 lazy_refcounts=off 
$ ls -l -h
total 136K
-rw-r--r-- 1 Trusty root 193K Apr 25 10:34 kali.qcow2

Since I’ve created the kali, ignore this article.

Deploy XAMPP On ArchLinux

###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

DXG ScreenSaver Hack

First, 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.