If this blog helped you in any way, please donate a dollar here

Saturday, September 2, 2017

[off] a poetry in the lovely city of bangalore



It has been a while I have had the heart or the mind to write some rhyming lines comprising of a poem, not that I have been particularly busy but maybe I was just fighting some battles that made me feel so. Bangalore, the silicon valley of India, the Garden City as they say it, is a beautiful city. The weather pleases me like no other city of this country, it is remarkable that I have to come back to the city from where I had started my professional journey.

So on a lovely rainy night I decided to try myself and type down some words in random order. Trying to sound lyrical and, to understand the beauty in words and expression.

So here goes, a poem untitled, as below

Its 4 am and the perfect time to get lonely,
As the world sleeps it comes to me very clearly
the silence wasn't meant for the deaf
the darkness wasn't meant for the blind
it is but the feelings inside of us
that we are destined to find.
Of course does that mean we can?
Is it so easy and effortless a task,
Sometimes senses fail us, comprehension we lose
The life in our blood from the bruises ooze
drop into the darkness we cannot see
fly into the noise we cannot hear
drown into the depths we cannot swim
nobody is here nor will be, my dear.

Friday, July 7, 2017

Logging PF Firewall on Mac OSX

Steps to enable logging for pfctl utility on newer osx like Yosemite, Sierra:

Firstly,

Add "log" to all rules in "/etc/pf.conf" or which ever PF configuration file you have.

Also set the logging interface with:

set loginterface pflog0

on the top of the PF config file.

Create a virtual interface with:

sudo ifconfig pflog0 create

Now start viewing packets which match the rules you logged with this:

sudo /usr/sbin/tcpdump -lnettti pflog0

At the end do:

sudo ifconfig pflog0 create

Monday, June 26, 2017

Fast download with Golang

Hey all, people keep saying about how great the concurrency is in golang. To be honest, I am pretty much a novice in this.

So just wrote a download accelerator in golang using it's much awesome parallel feature, the source of which can be found here: https://github.com/rghose/go-parallel-downloader

Here are a few results:

URL DownloadedTime taken by wgetTime taken by Golang
http://get.videolan.org/vlc/2.2.5.1/macosx/vlc-2.2.5.1.dmg1m3.375s0m26.609s

This was with GOMAXPROCS=2, threads = 5  with Chunk Size = 10 KB

So well, the chunk size of download did make a lot of difference, since the number of connections to download the thing would decrease, too many connections does not help in speed up


Tuesday, June 20, 2017

Get brightness levels on jailbroken ios devices

One liner:

idevicediagnostics ioreg IOPower | grep -A7 'brightness' | tail -n1 | egrep -o '\d+'

Explanation:

idevicediagnostics ioreg IOPower

This gives a lot of hardware info!

Monday, May 15, 2017

ADB Disable bluetooth on non-rooted devices

Here's a script to disable Bluetooth from non-rooted devices:

adb shell <<__eof
  input keyevent KEYCODE_WAKEUP;
  wm dismiss-keyguard;
  am start -a android.bluetooth.adapter.action.REQUEST_DISABLE;
  is_open=`dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp' | grep 'com.android.settings/com.android.settings.bluetooth.RequestPermissionHelperActivity'|wc -l`
  if [ $is_open = 0 ]; then exit; fi
  sleep 1;
  input keyevent KEYCODE_DPAD_RIGHT;
  input keyevent KEYCODE_DPAD_RIGHT;
  input keyevent KEYCODE_ENTER;
  exit;
__EOF

No warranties!

Thursday, May 11, 2017

Install mp4box on centos

Google behaved rather strangely today when I wanted to see how to install "Mp4Box". Yum search gave naught, so I decided to google this. On the hindsight maybe I needed better yum search fu for this.

As I was searching through the ways of installing MP4Box on Fedora / Centos I came up with installation instructions that asked me to build the application from source. Even the official website:  https://gpac.wp.imt.fr/mp4box/ provides no explanation on how to do it. They just have the official windows, debian and ios installers. It also offers an explanation to build from source on other linux-es.

While all this confusion is going round, the dude who had the requirement to simple and install gpac, since that is the name of the project! Well, guess what, it worked. So, here's how you install MP4Box on Fedora or CentOS :

Friday, April 28, 2017

RVM Ruby Execution with launchctl on osx

This addresses a problem that goes like this:

You want to create a launch file for launchd (launchctl) to run a ruby file periodically or as a daemon.

Various solutions to this problem include creating an RVM alias for the particular ruby version you want to use. Here I present a working version without aliases, just uses the default RVM Ruby. Please not that, for me, the default rvm ruby is 2.2.5.

When you create a sample plist file like this:



The rvm environment does get initialized. You get lots of gem issues.

The trick here lies in not running ruby but:

rvm-shebang-ruby

Simply use:

Ruby and RVM environments are now correctly updated.

Yeah and you don't need to create any aliases. It will work perfectly fine.