How to create a debian package

method 1
see also http://ubuntuforums.org/showthread.php?t=910717
supposing anything-sync-daemon-5.76 contains all package's files

Than simply create anything-sync-daemon-5.76/DEBIAN/control file with a similar content:
Package: anything-sync-daemon
Version: 5.76
Section: Utilities
Priority: optional
Architecture: amd64
Maintainer: Gigi Kent <gigi77@yahoo.com>
Description: anything sync daemon

then run
dpkg-deb --build anything-sync-daemon-5.76
dpkg-deb -c anything-sync-daemon-5.76.deb
sudo dpkg -i anything-sync-daemon-5.76.deb
method 2 (problem: will include only the doc files ...)
see also http://packaging.ubuntu.com/html/packaging-new-software.html
sudo apt-get install build-essential
e.g. for anything-sync-daemon
NEW_BUILD_NAME=anything-sync-daemon
NEW_BUILD_VER=5.76
NEW_BUILD_NAME_AND_VER=$NEW_BUILD_NAME-$NEW_BUILD_VER
ls -l /tmp/$NEW_BUILD_NAME-*
ls -l ~/ubuntu_packages/*/$NEW_BUILD_NAME-*
NEW_BUILD_NR=0
build command was something like this: make install DESTDIR=$NEW_BUILD_NAME_AND_VER
tar czf $NEW_BUILD_NAME_AND_VER.tgz $NEW_BUILD_NAME_AND_VER

e.g. package anything-sync-daemon
at this point anything-sync-daemon-5.76.tgz must exists!
bzr dh-make anything-sync-daemon 5.76 anything-sync-daemon-5.76.tgz
find anything-sync-daemon
cd anything-sync-daemon/debian
rm *ex *EX
rm README.source README.Debian
take the Ubuntu release name
lsb_release -a | grep Codename | awk '{print $2}'
and use it here (e.g. wily):
sed -i s/"unstable"/"wily"/ changelog
sed -i s/"gigi <gigi@unknown>"/"Gigi Kent <gigi77@yahoo.com>"/ changelog
sed -i s/"gigi <gigi@unknown>"/"Gigi Kent <gigi77@yahoo.com>"/ control
sed -i s/"Section: unknown"/"Section: Utilities"/ control
also fill Description in control file

Finally commit the code to your packaging branch
cd ..
now you should be back to the anything-sync-daemon directory
bzr add debian/source/format
bzr commit -m "Initial commit of Debian packaging ($NEW_BUILD_NAME)."
building the package
bzr builddeb -- -us -uc
lesspipe ../anything-sync-daemon_5.76-1_amd64.deb
check deb file for errors
lintian ../anything-sync-daemon_5.76-1_amd64.deb -> for single binary
lintian ../anything-sync-daemon_5.76-1_all.deb -> for indep binary
list deb content
dpkg-deb -c ../anything-sync-daemon_5.76-1_amd64.deb
dpkg-deb -c ../anything-sync-daemon_5.76-1_all.deb

ERROR
	bzr: ERROR: Unable to determine your name
	Please, set your name with the 'whoami' command.
SOLUTION
	bzr whoami "firstname name <email address>"
	e.g.:
	bzr whoami "Gigi Kent <gigi77@yahoo.com>"

Compiling anything sync daemon

Environment variables
NEW_BUILD_NAME=anything-sync-daemon
NEW_BUILD_VER=5.76
NEW_BUILD_NAME_AND_VER=$NEW_BUILD_NAME-$NEW_BUILD_VER
ls -l /tmp/$NEW_BUILD_NAME-*
ls -l ~/ubuntu_packages/*/$NEW_BUILD_NAME-*
NEW_BUILD_NR=0
# rm -r $HOME/temp/$NEW_BUILD_NAME_AND_VER

Download and unpack
cd $HOME/compile
wget http://repo-ck.com/source/anything-sync-daemon/anything-sync-daemon-5.76.tar.xz
tar xpvf anything-sync-daemon-5.76.tar.xz

Compilation
cd $HOME/compile/anything-sync-daemon-5.76
with systemd use
export DESTDIR=$HOME/temp/$NEW_BUILD_NAME_AND_VER;make V=1 install-systemd-all
with upstart use
export DESTDIR=$HOME/temp/$NEW_BUILD_NAME_AND_VER;make V=1 install-upstart-all

Packaging
cd $HOME/temp
tar czf $NEW_BUILD_NAME_AND_VER.tgz $NEW_BUILD_NAME_AND_VER
will yield e.g. anything-sync-daemon-5.76.tgz

Configuration
check for overlay:
sudo modprobe -c | grep overlay
edit in /etc/asd.conf:
USE_OVERLAYFS="yes"
check defined target directories:
grep -nr WHATTOSYNC /etc/asd.conf
preview mode (parse) command:
asd p
service management commands:
sudo systemctl status asd
sudo systemctl enable asd
sudo systemctl start asd

systemd service customization
use /etc/systemd/system/asd-resync.timer.d/frequency.conf
[Unit]
Description=Timer for Arofile-sync-daemon - 10min
[Timer]
# Empty value resets the list of timers
OnUnitActiveSec=
OnUnitActiveSec=10min

See also https://wiki.archlinux.org/index.php/Anything-sync-daemon.

Make ubuntu or applications run faster

See also
https://doc.ubuntu-fr.org/optimisation

Check ubuntu startup times
systemd-analyze blame

/etc/fstab
http://www.lgqyc.com/move-tmp-to-ram/
http://jsmylinux.no-ip.org/performance/improving-performance/
http://askubuntu.com/questions/173094/how-can-i-use-ram-storage-for-the-tmp-directory-and-how-to-set-a-maximum-amount
http://www.digitalinternals.com/unix/linux-io-performance-tuning-noatime-nodiratime-relatime/388/

mount | grep -P "^tmpfs.+/(tmp|var/run)"
sudo du -sh /tmp /var/tmp; du -sh /********/apps/tmp /********/apps/var/run /run/user/`id -u` /tmp/tomcat 2>/dev/null
 
tmpfs /tmp tmpfs defaults,relatime,mode=1777,size=4G 0 0
tmpfs /var/tmp tmpfs defaults,relatime,mode=1777,size=99G 0 0
tmpfs /********/apps/tmp tmpfs defaults,relatime,mode=1777,size=2G 0 0
tmpfs /********/apps/run tmpfs rw,nosuid,noexec,relatime,mode=755,size=2G 0 0

Firefox cache
see also http://kb.mozillazine.org/Browser.cache.memory.capacity
see also https://wiki.archlinux.org/index.php/Firefox_on_RAM

Main disadvantages of this method are that the content of currently browsed web pages is lost if browser 
crashes or after a reboot, and that the settings need to be configured for each user individually.

Open the url: about:config.
browser.cache.disk.enable false
browser.cache.disk.capacity 512000 -> 500M
browser.cache.memory.max_entry_size 512000 -> 500M appcache
browser.cache.memory.enable true
browser.cache.memory.capacity 1048576 -> 1G RAM
See the result in about:cache?device=memory (might require a firefox restart).

Increase the Speed at Which Firefox loads pages
see also http://bgr.com/2009/01/25/a-handful-of-firefox-tweaks-that-will-double-your-browser-speed/
see also http://www.techfragments.com/481/the-12-best-firefox-aboutconfig-performance-tweaks/

1. Type “about:config” into the address bar and hit Enter.
(Normally the browser will make one request to a web page at a time. When you enable pipelining it will make several at once, which really speeds up page loading.)

2. Alter the entries as follows:
Set “network.http.pipelining” to “true”
Set "network.http.pipelining.ssl” to “true”
see also network.http.proxy.pipelining
network.http.pipelining.maxrequests -> default 32; modified to 6
content.notify.ontimer -> created with value true (default anyway)
content.notify.backoffcount -> created with value 3 (default -1)
content.notify.interval -> default 120 000 microseconds; modified to 500 000

Chromium cache
see also https://wiki.archlinux.org/index.php/Chromium/Tips_and_tricks#Tmpfs
see also the cache chrome://cache/ -> takes an age to load ...
Allocate Chromium 1G of disk cache by modifying in any chromium-browser.desktop (Exec=chromium-browser lines):
chromium-browser --disk-cache-size=1073741824 --disk-cache-dir=/var/tmp/chromium-cache ...
see also https://www.chromium.org/user-experience/user-data-directory

Improve chrome performance
Navigate to chrome://flags and chrome://gpu/.
See video card info at https://adrhc.go.ro/wordpress/ubuntu-errors-problems-tips-tricks/

Enable these in chrome://flags/:
Enable experimental canvas features
Override software rendering list - canceled
Number of raster threads - 4
Enable GPU rasterization
Enable zero-copy rasterizer
Simple Cache for HTTP
Disable touch adjustment
Enable TCP Fast Open
LCD text antialiasing
Enable Download Resumption

Disable these in chrome://flags/:
Enable touch events
Enable pinch scale

Startup parameters:
grep "Exec=" /usr/share/applications/chromium-browser.desktop
grep "Exec=" $HOME/.local/share/applications/chromium-browser.desktop
Exec=chromium-browser --process-per-site --disk-cache-size=1073741824 --disk-cache-dir=/var/tmp/chromium-cache --enable-native-gpu-memory-buffers %U
Exec=chromium-browser --process-per-site --disk-cache-size=1073741824 --disk-cache-dir=/var/tmp/chromium-cache --enable-native-gpu-memory-buffers
Exec=chromium-browser --process-per-site --disk-cache-size=1073741824 --disk-cache-dir=/var/tmp/chromium-cache --enable-native-gpu-memory-buffers --incognito
Exec=chromium-browser --process-per-site --disk-cache-size=1073741824 --disk-cache-dir=/var/tmp/chromium-cache --enable-native-gpu-memory-buffers --temp-profile

Firefox & Chromium profile
see also http://ubuntuforums.org/showthread.php?t=1921800&page=2
see also https://wiki.archlinux.org/index.php/Profile-sync-daemon
see also https://wiki.archlinux.org/index.php/Anything-sync-daemon
sudo add-apt-repository ppa:graysky/utils
sudo apt-get update
sudo apt-get install profile-sync-daemon
psd p -> creates /********/.config/psd/psd.conf
Primary configuration:
gedit /********/.config/psd/psd.conf
USERS="gigi bob"
USE_OVERLAYFS="yes"
BROWSERS="chromium"
USE_BACKUPS="yes"
Add to /etc/sudoers (required by psd.service USE_OVERLAYFS="yes"):
gigi ALL=(ALL) NOPASSWD: /usr/bin/psd-overlay-helper
secondary configuration
mkdir -p ~/.config/systemd/user/psd-resync.timer.d
gedit ~/.config/systemd/user/psd-resync.timer.d/frequency.conf
[Unit]
Description=Timer for Profile-sync-daemon
PartOf=psd.service
[Timer]
OnUnitActiveSec=10m
Enable & start the service:
systemctl --user enable /usr/lib/systemd/user/psd.service
systemctl --user start psd
systemctl --user status psd
Stop & disable the service:
systemctl --user stop psd
systemctl --user disable psd
Check psd installation & configuration:
profile-sync-daemon parse
psd p
ls -l ~/.mozilla/firefox/
ls -l /run/user/`id -u`

Plex
Server -> Transcoder: /var/tmp/plex-transcoding

Linux hdd defragmentation
see also http://www.hecticgeek.com/2012/10/defragment-ext4-file-systems-using-e4defrag-ubuntu/

HDD performance
see also https://www.kernel.org/doc/Documentation/block/queue-sysfs.txt
see also https://wiki.mikejung.biz/Ubuntu_Performance_Tuning
see also https://wiki.mikejung.biz/OS_Tuning

hdd performance info
echo "queue_depth: $(cat /sys/block/sda/device/queue_depth)"; echo "nr_requests: $(cat /sys/block/sda/queue/nr_requests)"; echo "read_ahead_kb: $(cat /sys/block/sda/queue/read_ahead_kb)"
echo "queue_depth: $(cat /sys/block/sdb/device/queue_depth)"; echo "nr_requests: $(cat /sys/block/sdb/queue/nr_requests)"; echo "read_ahead_kb: $(cat /sys/block/sdb/queue/read_ahead_kb)"

Queue_depth (default 31)
cat /sys/block/sda/device/queue_depth
cat /sys/block/sdb/device/queue_depth

I/O scheduler queue size (default 128)
How many requests may be allocated in the block layer for read or write requests.
cat /sys/block/sda/queue/nr_requests
su	-> won't work using sudo ...
echo 1024 > /sys/block/sda/queue/nr_requests
cat /sys/block/sdb/queue/nr_requests
su
echo 1024 > /sys/block/sdb/queue/nr_requests

Maximum number of kilobytes to read-ahead
cat /sys/block/sda/queue/read_ahead_kb	-> default 128
cat /sys/block/sdb/queue/read_ahead_kb

Print readahead in 512-byte sectors (http://man7.org/linux/man-pages/man8/blockdev.8.html)
sudo blockdev --getra /dev/sda		-> default 256 (always double to read_ahead_kb above)
sudo blockdev --getra /dev/sdb

This file (/sys/block/sda/queue/add_random) allows to turn off the disk entropy contribution. Default value of this file is '1'(on).
cat /sys/block/sdb/queue/nr_requests
su	-> won't work using sudo ...
echo 1 > /sys/block/sdb/queue/nr_requests

Persist using /etc/rc.local
blockdev --setra 256 /dev/sda
echo 1 > /sys/block/sda/queue/add_random

Disable IPv6 support
Check ipv6 status (1 = disabled)
cat /proc/sys/net/ipv6/conf/all/disable_ipv6

Add to /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6=1  
net.ipv6.conf.default.disable_ipv6=1  
net.ipv6.conf.lo.disable_ipv6=1

Disable loading of ivp6 module into kernel during booting
see also http://linuxpoison.blogspot.com/2009/06/how-to-disable-loading-of-unnecessary.html
Edit /etc/modprobe.d/blacklist.conf
blacklist ipv6

/etc/sysctl.conf
vm.swappiness=1
This option controls the tendency of the kernel to reclaim the memory which is used for caching of directory and inode objects.
At the default value of vfs_cache_pressure=100 the kernel will attempt to reclaim dentries and inodes at a "fair" rate with respect to pagecache and swapcache reclaim. Decreasing vfs_cache_pressure causes the kernel to prefer to retain dentry and inode caches. When vfs_cache_pressure=0, the kernel will never reclaim dentries and inodes due to memory pressure and this can easily lead to out-of-memory conditions. Increasing vfs_cache_pressure beyond 100 causes the kernel to prefer to reclaim dentries and inodes.
vm.vfs_cache_pressure=5