Skip to content

Instantly share code, notes, and snippets.

@shreeshga
shreeshga / Utilities.java
Last active July 8, 2018 11:32
Android setSringSet() / getStringSet() with compatibility
public static void setPersistentObjectSet(Context context, String key, String o) {
if (initStore(context)) {
synchronized (_store) {
SharedPreferences.Editor editor = _store.edit();
if (o == null) {
editor.remove(key);
} else {
Set<String> vals = null;
if (VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
vals = _store.getStringSet(key, null);
/**
* CSS theme for the Clearly browser extension by Evernote.
* See: www.evernote.com/clearly/
*
* Options used alongside this CSS:
*
* Fonts:
* Body font: Ubuntu
* Header font: Verdana, Helvetica
* Monospace font: Droid Sans Mono
@shreeshga
shreeshga / gist:5113944
Created March 8, 2013 03:10
mac shared lib errors
make CFLAGS='-arch i386 -arch x86_64' CXXFLAGS='-arch i386 -arch x86_64' LDFLAGS='-arch i386 -arch x86_64'
@shreeshga
shreeshga / merge_pdf.txt
Created October 17, 2012 13:48
merge pdf files from commandline
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=dest_file.pdf file1.pdf file2.pdf
@shreeshga
shreeshga / sed.txt
Created September 26, 2012 17:57
sed quick help guide
HANDY ONE-LINERS FOR SED (Unix stream editor) Oct. 29, 1997
compiled by Eric Pement <[email protected]> version 4.3
Latest version of this file is always at <http://www.wollery.demon.co.uk>
FILE SPACING:
# double space a file
sed G
# triple space a file
sed 'G;G'
@shreeshga
shreeshga / .muttrc
Created August 31, 2012 20:15
mutt rc file
# A basic .muttrc for use with Gmail
# Change the following six lines to match your Gmail account details
set imap_user = "[email protected]"
set copy=yes
set smtp_url = "smtps://[email protected]@smtp.gmail.com:465/"
set from = "[email protected]"
set realname = "shreesh ayachit"
# Change the following line to a different editor you prefer.
@shreeshga
shreeshga / .gtiignoreglobal
Created August 31, 2012 20:04
git ignore global
# Xcode
###################
build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
@shreeshga
shreeshga / .bashrc
Created August 28, 2012 20:43
Mac bash common aliases and settings
export LSCOLORS=excx
export PS1="\W=>"
alias ssh="ssh -X"
alias md="mkdir -p"
alias rd="rmdir"
alias df="df -h"
alias mv="mv -i"
alias slink="ln -s"
alias sed='sed -E'
alias l='ls -1'
@shreeshga
shreeshga / pretty_build.py
Created August 8, 2012 18:02
Pretty printing ANT build
from clint.textui import puts, colored, indent, progress
from progressbar import ProgressBar,Percentage,Bar
import pbs
import time
from string import lower
import sys
import argparse
def isError(line):
if 'error:' in line: # script errors
@shreeshga
shreeshga / delete_lines.md
Created July 19, 2012 20:42
Delete all lines matching pattern in vim

The ex command g is very useful for acting on lines that match a pattern. You can use it with the d command, to delete all lines that contain a particular pattern, or all lines that do not contain a pattern.

For example, to delete all lines containing "profile" (the first command is optional; it shows the lines that the second command will delete):

:g/profile
:g/profile/d

More complex patterns can be used, such as deleting all lines that are empty or that contain only whitespace: