Mind Mining Medium

April 10, 2013

Copy (cp) with progress bar

Many times you’d like to see the progress of a copy but sadly cp doesn’t have that feature.

Many posts online will show bash scripts that pipe cp into grep/awk/etc or use tools like pv. Alas, there is a much more simple way. Use rsync.


Throw the --stats flag for some stats after the transfer is done.

rsync -a --stats --progress SOURCE_FOLDER DESTINATION_FOLDER
March 25, 2013

Apache time sensitive conditions

If you’d like to do time sensitive conditionals on Apache, the following will help you get started. This is useful if you’d like certain content to be displayed based on time.

<!--#config timefmt="%Y%m%d%H%M" -->
<!--#if expr="$DATE_LOCAL < 201303281140" -->
    <!--#include virtual="before.html"-->
<!--#elif expr="$DATE_LOCAL >= 201303281140 && $DATE_LOCAL <= 201303281205"-->
    <!--#include virtual="during.html"-->
    <!--#include virtual="after.html"-->

What we do here is set the time format to %Y%m%d%H%M which is year, month, day, hour, minute. For example “201303281140” for March 28th, 2013 at 11:40am.

Then if the current server time is before set time, we display before.html; if the time is during our two times, we display during.html; else we display after.html.

September 29, 2012

Unroot and Reset the Sprint Galaxy Nexus - Mac

Warning: The following steps WILL format the device. Be sure to do a complete backup before preceeding.

  1. Download the Android SDK.

  2. Install the SDK as instructed.

  3. Follow the instructions on this page from the Android SDK’s “Adding Platforms and Packages

  4. Check and install the “Android SDK Platform-Tools” only.

  5. You should have a directory called android-sdk-mac_x86. Within that, there should be directory called Platform-Tools.

  6. Go as instructed to the “Return To Stock (ODIN TARS & FASTBOOT IMGS)” page. Second post will have the FASTBOOT images. For stock Jelly Bean search for FH05. There is 6 files that need to download.

  7. Place all the downloaded files inside android-sdk-mac_x86/platform-tools/ directory.

  8. Shut down the device, then press and hold Volume Up, Volumn Down, and Power at the same time. This will enter to the bootloader.

  9. Connect the device via USB to the computer.

  10. Open terminal and go into the “platform-tools” directory.

  11. Enter the following lines, one at a time.
    ./fastboot flash boot boot.img
    ./fastboot flash bootloader bootloader.img
    ./fastboot flash recovery recovery.img
    ./fastboot flash system system.img
    ./fastboot flash radio radio-cdma.img
    ./fastboot flash radio radio-lte.img
    ./fastboot -w
  12. Enter the following to lock the device also.
    ./fastboot oem lock