Skip to content

Instantly share code, notes, and snippets.

Avinash Ananth Narayan R Avinash-Bhat

Block or report user

Report or block Avinash-Bhat

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
View rainbow_brackets.xml
<application>
<component name="RainbowSettings">
<option name="rainbowifyHTMLInsideJS" value="true" />
<option name="version" value="5.1" />
<option name="lightRoundBracketsColors">
<array>
<option value="0x263238" />
<option value="0x455a64" />
<option value="0x607d8b" />
<option value="0x90a4ae" />
@Avinash-Bhat
Avinash-Bhat / script.groovy
Created Sep 27, 2016
jenkins script for android sdk license
View script.groovy
def dir = new File('path_to_sdk')
def licenses = new File(dir, 'licenses')
if (!licenses.exists()) licenses.mkdir()
dir.listFiles().each { println it }
def pw = new PrintWriter(new File(licenses, 'android-sdk-license'))
pw.println('8933bad161af4178b1185d1a37fbf41ea5269c55')
@Avinash-Bhat
Avinash-Bhat / bandcamp.js
Last active Apr 29, 2016 — forked from icodeforlove/bandcamp.js
download mp3's from bandcamp
View bandcamp.js
var commands = [];
commands.push('mkdir "' + TralbumData.current.title + '"');
commands.push('cd "' + TralbumData.current.title + '"');
TralbumData.trackinfo.forEach(function (track, index) {
if (track.file) {
var href = track.file['mp3-128'];
@Avinash-Bhat
Avinash-Bhat / gologging_test.go
Last active Jan 28, 2017
benchmark for disabling logs with various packages
View gologging_test.go
package main
import (
logging "github.com/op/go-logging"
"io/ioutil"
"log"
"os"
"testing"
)
View ClientCreator.java
OkHttpClient createClient() {
final OkHttpClient client = new OkHttpClient();
// ...
client.networkInterceptors().add(chain -> {
Request request = chain.request();
if (DEBUG) {
log(request);
} else {
String protocolPrefix = request.isHttps() ? "S" : "";
Log.i(TAG, String.format("---> HTTP%s %s %s",
@Avinash-Bhat
Avinash-Bhat / git-version.gradle
Last active Jan 20, 2017
Gist for versioning an android application.
View git-version.gradle
/**
* Copyright 2016 Avinash Ananth Narayan R
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@Avinash-Bhat
Avinash-Bhat / auto-hibernate
Last active Aug 29, 2015
auto-hibernate script and systemd service
View auto-hibernate
#!/usr/bin/env bash
print_usage() {
echo " Usage: $0 [upper-threshold]"
}
if [ -z $1 ];
then
echo "ERROR: upper threshold should be specified"
print_usage
@Avinash-Bhat
Avinash-Bhat / datediff
Last active Aug 29, 2015
Coffeescript to find difference in date
View datediff
#!/usr/local/bin/coffee
SEC = 1000
MIN = SEC * 60
HOUR = MIN * 60
DAY = HOUR * 24
WEEK = DAY * 7
if process.argv.length != 4
console.log "Insufficient arguments to complete call"
@Avinash-Bhat
Avinash-Bhat / custom_rules.xml
Last active Apr 18, 2016
[DEPRECATED] Automatic versioning in Android using Ant and Git
View custom_rules.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="application-custom">
<macrodef name="git" taskname="@{taskname}">
<attribute name="command" />
<attribute name="dir" default="" />
<attribute name="property" default="" />
<attribute name="taskname" default="" />
<attribute name="failonerror" default="on" />
<element name="args" optional="true" />
@Avinash-Bhat
Avinash-Bhat / factory.js
Last active Dec 13, 2015
Object.create vs (evil) eval for creating an object of different types according to the arguments received.
View factory.js
function createObject (clazz, args) {
var o;
if (Object.create) {
o = Object.create(clazz)
clazz.constructor.apply(xx, args);
} else {
// screwed! nothing other than evil-eval :-(
o = eval("new " + clazz.constructor.name + "(" + args + ")");
}
}
You can’t perform that action at this time.