Mount HTC one M8 system partition as read write

8640130789_fca56a4e5d_htc

So why cant you write to system partition on HTC devices even after rooting? it’s because they are S-ON by default. which means that neither can you access certain areas of the system nor can you guarantee a permanent root. S-OFF means that the NAND part of the device is unlocked and can be written to. S-ON also has some other restrictions like image signatures etc. to make an end run around the S-ON problems, you can temporarily mount your system partition as read/write by running the following commands via ADB. or just the last two lines in terminal emulator on the device itself.

 

 

Sample apt.sources file with

bash apt-get

Remove the us. part f you arent on a US server.

change the word precise to whatever your version of ubuntu is.

Find out whats taking up all the space

10094118346_d95facff6e_q_disk-space

running out of space and need to find out whats taking up all that space? type the following command to find out more :

 

Start Xvfb automatically on boot on Centos

add the following as a script to /etc/init.d , chmod +x the script then chkconfig xvfb on

 

 

Windows clean up multiple partitions via CLI

windows-7-disk-manager

I had to install a new copy of windows, sadly the USB drive at hand had about 11 small partitions on it due to some earlier work. When I tried formatting it, it formatted only one part of it and was annoying in general… when I checked disk management, I was only able to delete a few of the small partitions. Heres how I did it via CLI / cmd line.

see which one is your disk, such as mine was the last on the list since I had just plugged it in, make sure to match up the size etc also i.e. this will erase your disk so be very very careful. then run the following command substituting 10 for whatever your disk # is:

then exit and exit again. voilà.

Bash sequential counting / stepping

Want to count from 1 – 100 and list each number sequentially?

Same as above but add a timestamp?

Again same as above but now we step every 3 numbers instead of every 1

 

now for something slightly harder, we add each successful result to the next number after it.

How about if we echo every resultant number before the total?

 

dpkg-divert local redirection of bins in Ubuntu

diversions ahead!

It seems sometimes you get a new package from somewhere and its just an update for an older package but from a different author, or a slightly different functioning bin. The dpkg-divert command allows you to replace a binary installed upon the system, and have this replacement persist even if you upgrade packages. One common reason to do this is if you’re using a mailserver such as qmail, and you wish to replace the file /usr/lib/sendmail with the version from that package. In this case making a diversion is a good solution. Well you can locally divert how you refer to the bin and make dpkg aware of this via the following command :

In this case our package provides sumguy-longer-name-newer-package  as the binary and hence the command, but thats a LOT to type :( we just want to call it by its simpler name of
so we use the above divert command and voila! we are good to go.

 

dot command not found

Was trying to run doxygen on a new machine, got this error :

realized I was missing graphviz, so a simple yum install graphviz fixed it right up :)

Adding extra Swap to Linux

On one of my servers I needed extra swap space because the datacenter screwed up the partitioning and I didn’t have time to reimage the machine. so an easy way to add swap after partitioning is just to add it via a new file on any partition.

lets say you want to add 8GB of swap in a file called swapfile based in /

This will last till a reboot, so you need to add it to /etc/fstab.  type :

add at the bottom :

and you are done :)

 

Repair & Optimize all Mysql Databases one liner

Mysql tuner telling you to optimize your tables? or you just happen to be bored? well use this one liner to repair/optimize all your DBs in one go.

voila!