Skip to content

Instantly share code, notes, and snippets.

View Keshava11's full-sized avatar
🎯
Focusing

Bruce Keshava11

🎯
Focusing
View GitHub Profile
@Keshava11
Keshava11 / districts_block_map.json
Last active January 13, 2022 17:40
List of Indian districts and blocks as json
[{"name": "NICOBAR", "code": "3101", "stateCode": "31", "blockList": [{"name": "CAMPBELL BAY", "code": "6498"}, {"name": "CAR NICOBAR", "code": "6499"}, {"name": "NANCOWRIE", "code": "6500"}]}, {"name": "NORTH AND MIDDLE ANDAMAN", "code": "3102", "stateCode": "31", "blockList": [{"name": "DIGLIPUR", "code": "7667"}, {"name": "MAYABUNDER", "code": "6495"}, {"name": "RANGAT", "code": "6497"}]}, {"name": "SOUTH ANDAMAN", "code": "3103", "stateCode": "31", "blockList": [{"name": "FERRARGUNJ", "code": "7668"}, {"name": "LITTLE ANDAMAN", "code": "7669"}, {"name": "PROTHRAPUR", "code": "6496"}]}, {"name": "ANANTPUR", "code": "111", "stateCode": "1", "blockList": [{"name": "AGALI", "code": "4686"}, {"name": "AMADAGUR", "code": "4687"}, {"name": "AMARAPURAM", "code": "4688"}, {"name": "ANANTAPUR", "code": "4689"}, {"name": "ATMAKUR", "code": "4690"}, {"name": "BATHALAPALLE", "code": "4691"}, {"name": "BELUGUPPA", "code": "4692"}, {"name": "BOMMANAHAL", "code": "4693"}, {"name": "BRAHMASAMUDRAM", "code": "4694"}, {"nam
@Keshava11
Keshava11 / rsync_windows.md
Created September 9, 2021 16:18
Add rsync (Git Bash) to WIndows 10
@Keshava11
Keshava11 / CountryCodeInputFilter.java
Created February 6, 2018 11:02
Simplest input filter (non-editable country code prefix) for a Phone Number EditText.
/**
* InputFilter for Myanmar Phone Numbers
* TODO Update it for all country codes
*/
class CountryCodeInputFilter implements InputFilter {
@Override
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
//Back Key Press conditions
boolean deleteCond0 = dstart == 0 && dend == 1; // +
@Keshava11
Keshava11 / Setters-Mutators
Created March 2, 2017 10:42
Android Studio Setter template for member names starting with 'm' and 's' without 'm' and 's' in method name.
#set($paramName = $helper.getParamName($field, $project))
public ##
#if($field.modifierStatic)
static ##
#end
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
#if ($name.length() > 1 && ($StringUtil.startsWith($name, 'm') || $StringUtil.startsWith($name, 's')))
#set($name = $name.substring(1))
#if ($paramName.length() > 1 && ($StringUtil.startsWith($paramName, 'm') || $StringUtil.startsWith($paramName, 's')))
#set($paramName = "i"+$paramName.substring(1))
@Keshava11
Keshava11 / Getters-Accessors
Created March 2, 2017 10:39
Android Studio Getter template for member names starting with 'm' and 's'
#if($field.modifierStatic)
static ##
#end
$field.type ##
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
#if ($name.length() > 1 && ($StringUtil.startsWith($name, 'm') || $StringUtil.startsWith($name, 's')))
#set($name = $name.substring(1))
#end
#if ($field.boolean && $field.primitive)
#if ($StringUtil.startsWithIgnoreCase($name, 'is'))
@Keshava11
Keshava11 / DesktopUtils.sh
Created March 2, 2017 06:39
Simple bash script providing options for few utility functions like restarting nautilus, starting dropbox, syncing some file into the dropbox etc (Linux only).
#!/bin/sh
# Prerequisites :
# Following script is a collection of utility that I need in my machine. You can personalize it for your own requirement
# System must have installed nautilus(for 1st option), dropbox(for 2nd option), python with dropbox sdk setup (for 3rd option as given here https://goo.gl/1d8RC3)
# Read input selection from the listview
input_opt=$(zenity --list \
@Keshava11
Keshava11 / SFileUploader.py
Created February 22, 2017 09:02
Simple python script to upload file to Dropbox.
#!python3.5
# Prerequisites :
# 1.SetUp dropbox sdk to be able to use Dropbox Api's
# $ sudo pip install dropbox
# By default python dropbox sdk is based upon the python 3.5
#
# 2. Create an App on dropbox console (https://www.dropbox.com/developers/apps) which will be used and validated to do
# the file upload and restore using dropbox api. Mostly you need an access token to connect to Dropbox before actual file/folder operations.
#
@Keshava11
Keshava11 / youtubedownloader.sh
Created February 15, 2017 20:34
Youtube downloader script for Ubuntu
#!/bin/sh
#PreRequisites : zenity, youtube-dl must be installed
#Reads the input url from the window
youtube_url=$(zenity --entry --title="Download" --text="Enter youtube url" --width=300)
echo "Youtube video url is : $youtube_url"
#Following command downloads the video
youtube-dl -f 22 -cit $youtube_url
@Keshava11
Keshava11 / .bash_profile
Created January 28, 2017 22:29 — forked from paulocheque/.bash_profile
.bash_profile example
# EDITOR=nano sudo visudo
# Change the following line: (:i to insert + esc to go back + :w to save + :q to quit)
# Defaults env_reset
# to:
# Defaults env_reset,timestamp_timeout=960 # in minutes
export PATH=$PATH:.
# export PATH=$PATH:/usr/bin
@Keshava11
Keshava11 / DbImportUtils.java
Created January 9, 2017 12:25
Android : Utility to import external database from assets into internal storage
import android.content.Context;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
/**
* Utility to import database from assets into the internal storage
*/