Skip to content

Instantly share code, notes, and snippets.

Lenin Raj Rajasekaran emaillenin

Block or report user

Report or block emaillenin

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
@emaillenin
emaillenin / HomeActivity.java
Created Dec 16, 2017
Branch Analytics and Referral Tracking for Custom APK files
View HomeActivity.java
@Override
public void onStart() {
super.onStart();
Branch branch = Branch.getInstance();
branch.initSession(new Branch.BranchReferralInitListener() {
@Override
public void onInitFinished(JSONObject referringParams, BranchError error) {
if (error == null) {
// params are the deep linked params associated with the link that the user clicked -> was re-directed to this app
@emaillenin
emaillenin / DownloadManagerActivity.java
Created Dec 11, 2016
Download APK using DownloadManager and start installation automatically - Android 7.0 Nougat compatible
View DownloadManagerActivity.java
public void downloadUpdate() {
DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
String destination = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/";
String fileName = "your_app.apk";
destination += fileName;
final Uri uri = Uri.parse("file://" + destination);
File file = new File(destination);
if (file.exists())
file.delete();
View hyper.js
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 14,
// font family with optional fallbacks
fontFamily: 'Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.75)',
@emaillenin
emaillenin / Steps.txt
Created Jul 1, 2014
Working with a forked Github project
View Steps.txt
1. Fork the project
2. git clone <your-forked-repo>
3. Add a new remote of the original repo
4. Pull changes from original repo frequently and rebase against your local
5. Push changes to your repo
6. Create pull create and send it to the original repo!
View README.md

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@emaillenin
emaillenin / my_bash_profile.sh
Last active Aug 29, 2015
my_bash_profile.sh
View my_bash_profile.sh
# Inspired from https://gist.github.com/selvakn/358558
export HISTORYFILESIZE=10000
export PS_COLOR="0;32"
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /'
}
@emaillenin
emaillenin / remove_brace.rb
Created Mar 9, 2014
Removes the opening and the closing brace using regex
View remove_brace.rb
"(hey there!)".gsub(/^\(|\)$/,'')
@emaillenin
emaillenin / columns_accessed_recently.sql
Created Dec 12, 2013
Finds the columns that has been recently accessed in Teradata
View columns_accessed_recently.sql
select ObjectColumnName from dbc.dbqlobjtbl a
join dbc.dbqlogtbl b on a.ProcID = b.ProcID
and a.QueryID = b.QueryID
where ObjectDatabaseName = 'database_name' and ObjectTableName = 'table_name' and statementtype = 'Select' and ObjectType = 'Col'
@emaillenin
emaillenin / git-setup.sh
Created Aug 4, 2013
Creating a remote git repository
View git-setup.sh
cd git-repo-dir
mkdir repo-name
cd repo-name
git init --bare
cd ..
chown -R gituser:gituser repo-name
/** In Git GUI, add a remote repo with URL as **/
@emaillenin
emaillenin / convertNumberToWordsForIndia9Digits.vb
Last active Dec 15, 2015
Converts a number (a currency) into words for Indian Format.. Supports upto 9 Digits.
View convertNumberToWordsForIndia9Digits.vb
Public Function convertNumberToWordsForIndia9Digits(ByVal number As Decimal)
'Based on this - http://www.php.net/manual/en/function.number-format.php#108532
'If you know the C# version, share it here http://blog.emaillenin.com
Dim words As New Hashtable
words.Add("0", "")
words.Add("1", "One")
words.Add("2", "Two")
words.Add("3", "Three")
words.Add("4", "Four")
words.Add("5", "Five")
You can’t perform that action at this time.