Skip to content

Instantly share code, notes, and snippets.

@pratul
pratul / kabala-calc.py
Created January 18, 2011 14:58
A numerological calculator based on the Kabbalah alphabet. (from Linda Goodman's "Star Signs")
#!/usr/bin/python
# authored by Pratul Kalia in January 2011.
# Released into the public domain.
import sys
# Chaldean-Hebrew Kabala Numberical Alphabet.
# Taken from the book "Star Signs" by Linda Goodman.
kabala = {'a': 1, 'b': 2, 'c': 3, 'd': 4,
'e': 5, 'f': 8, 'g': 3, 'h': 5,
@pratul
pratul / gist:796885
Created January 26, 2011 15:53
lut4rp's dot emacs file
;;; ---------------------
;;; dot emacs
;;; Pratul Kalia (lut4rp)
;;; ---------------------
;;;
;; Mac full screen mode
(defun mac-toggle-max-window ()
(interactive)
(set-frame-parameter nil 'fullscreen (if (frame-parameter nil 'fullscreen) nil 'fullboth))
@pratul
pratul / .zshrc
Created November 8, 2011 18:25
My .zshrc
####
# lut4rp's zshrc
# "You could've been anywhere in the world, but you're here with us... And we appreciate that."
####
# Aliases
alias ls='ls -hG'
alias ll='ls -lh'
alias la='ls -ah'
alias sl=ls
@pratul
pratul / gist:1530136
Created December 28, 2011 22:28
git information in your bash prompt
## 4 8 15 16 23 42
export PS1="\n\[$(tput setaf 7)\]\w\n\`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\\\\\*\ \(.+\)$/\(\\\\\\\\\1\)\/\`>: \[$(tput sgr0)\]"
@pratul
pratul / Android.gitignore
Last active February 4, 2016 09:48
A .gitignore file for Android projects
gradle
gradlew*
.gradle
local.properties
.DS_Store
build/
# Legacy
.classpath
.project
@pratul
pratul / gist:3750313
Last active June 29, 2016 10:20
Discipline, not motivation
There’s a lot of problems with simple motivation:
Motivation is fleeting. Motivation comes and goes however it wants. It might not last to the end of the week, end of the day,
or even the end of blog post you just read. It’s fleeting.
Motivation is situational. Motivation is based on your current situation. How do you feel? If you don’t feel like doing it,
then you’re off the hook. You don’t have to do it – because you don’t feel like it! But then you don’t do it and you just feel
worse and more stuck than ever.
Motivation is everywhere. Everywhere you go, you see people trying to get motivated to do something, to make a change. They’ll
@pratul
pratul / lut4rp.gitconfig
Last active August 29, 2015 13:57
My gitconfig
[user]
name = Pratul Kalia
email = pratul@pratul.in
[alias]
br = branch
cm = commit -am
cma = commit -a
co = checkout
di = diff
dil = diff HEAD^..HEAD
@pratul
pratul / google-android.xml
Created November 11, 2014 13:21
Android IntelliJ/Android Studio codestyle
<?xml version="1.0" encoding="UTF-8"?>
<code_scheme name="GoogleAndroid">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
public class SortedListAdapter extends IntegerListAdapter {
private SortedList<Integer> sortedList;
public SortedListAdapter() {
this.sortedList = new SortedList<>(Integer.class, new SortedListAdapterCallback<Integer>(this) {
@Override public int compare(Integer item1, Integer item2) {
return item1.compareTo(item2);
}
@Override public boolean areContentsTheSame(Integer oldItem, Integer newItem) {
@pratul
pratul / android-versioncode-git-describe.gradle
Last active March 1, 2017 06:14
A gradle method to generate Android versionCode using git describe.
def getVersionCode = { ->
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-list', '--first-parent', '--count', 'origin/master'
standardOutput = stdout
}
return Integer.parseInt(stdout.toString().trim()) * 100
}
catch (ignored) {