Skip to content

Instantly share code, notes, and snippets.

Ashish Bhatia ashishb

Block or report user

Report or block ashishb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ashishb /
Created Nov 16, 2018
Opens url of a file corresponding to a local file
# Usage: ghurl <filepath>
# Opens the file in github corresponding to a local path. Respects repo name, branch name (defaults to master).
function ghurl() {
domain='' &&
repo=$(git config --get remote.origin.url | cut -d: -f2 | cut -d. -f1) &&
# Fallback to master branch
remoteBranch=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null || echo 'master') &&
# Remove origin prefix
remoteBranch=${remoteBranch#origin/} &&
currentDir=$PWD &&
from collections import Counter
FILENAME = 'aspath.txt'
f = open(FILENAME, 'r')
for line in f:
# print 'Line read is ', line
mylist = line.split()
ashishb / gist:da145a877139fcd91e3f
Created Jul 6, 2014
Fix for "Unapproved caller. SecurityAgent may only be invoked by Apple software"
View gist:da145a877139fcd91e3f
- Start on single user mode: Hit the Command and S keys at start-up
Wait until the writing stops completely
-At the line, type (after root): /sbin/fsck -fy (space after the k)
Hit the ENTER key
wait until it finishes and says "... appears to be OK"
next, type: /sbin/mount -uw / (space after the t and after the w)
ashishb / gist:266a71d06d308bd96eed
Created Jun 27, 2014
Fix to a problem installing "Android Studio" via homebrew on Mac OS X.
View gist:266a71d06d308bd96eed
# Problem
$ open -a Android\ Studio
LSOpenURLsWithRole() failed for the application /opt/homebrew-cask/Caskroom/android-studio/0.6.1 build-135.1224218/Android with error -10810.
# Fix
$ /usr/libexec/PlistBuddy -c 'Set :JVMOptions:JVMVersion 1.8*' //opt/homebrew-cask/Caskroom/android-studio/0.6.1\ build-135.1224218/Android\
ashishb / gist:9334297
Created Mar 3, 2014
Install atom without invite
View gist:9334297
# Install Atom directly without invitation
# by @leaskh
cd ~
curl -L -A "Atom/0.1 CFNetwork/1.5" >
mv /Applications/
rm -rf
View gist:9245170
### Keybase proof
I hereby claim:
* I am ashishb on github.
* I am ashishb ( on keybase.
* I have a public key whose fingerprint is DC5D 1E98 F335 E7B3 8E78 C25F 1BDE 4BB1 723D 0912
To claim this, I am signing this object:
View gist:8604460
// A fault tolerant Google apps script for fetching dividend data from Yahoo Finance (original fault intolerant script was taken from
function GetDividends(symbol) {
/* Manipulate the symbol, as necessary */
if (\.b/i) >= 0)
symbol = symbol.replace(/\.b/i, "-B");
ashishb / gist:7838656
Last active Dec 30, 2015
A small monkeyrunner script to automate "Tinder" likes
View gist:7838656
# Run this script using Monkeyrunner.
import commands
import time
from import MonkeyRunner, MonkeyDevice
def click(device, x, y):
device.touch(x, y, MonkeyDevice.DOWN_AND_UP)
View gist:7668357
import hashlib
even_count = 0
odd_count = 0
for x in xrange(0, 1000, 1):
if int(hashlib.sha256(str(x)).hexdigest(), 16)%2 == 0:
even_count += 1
odd_count += 1
You can’t perform that action at this time.