Skip to content

Instantly share code, notes, and snippets.

ADBShell () { adb ${2+-s }$2 shell "$1" | tr -d '\r'
GetAndroidVersion () {
local ALL_TAGS=$(wget -qO - "$GOOGLE_SOURCE/$REPO/+refs/tags/?format=text" | \
tr -d '^{}' | cut -d/ -f3 | sort -u | grep -vE -- '-(cts|sdk)-' | grep -v "_r0")
TAG=${1:-$(ADBShell 'getprop')}
staltz /
Last active Jan 21, 2022
The introduction to Reactive Programming you've been missing
lttlrck / gist:9628955
Created Mar 18, 2014
rename git branch locally and remotely
View gist:9628955
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
timyates /
Last active Mar 7, 2020
Currying and composition in Java 8
package java8tests ;
import java.util.function.BiFunction ;
import java.util.function.Function ;
public class Currying {
public void currying() {
// Create a function that adds 2 integers
BiFunction<Integer,Integer,Integer> adder = ( a, b ) -> a + b ;
sporsh / packet-adb.c
Created Apr 19, 2013
Android Debug Bridge (ADB) dissector for Wireshark
View packet-adb.c
* packet-adb.c
* Routines for Android Debug Bridge (ADB) protocol dissection
* Author: Geir Sporsheim <>
#include "config.h"
lolindrath / gist:4454638
Last active Jan 8, 2020 — forked from mdb/gist:4288296
How to Amend a Git Commit
View gist:4454638
# View the log to find the commit you want to edit:
git log
# Quit out of the log
# Rebase from the commit you want to edit, in interactive mode:
git rebase SOME_COMMIT_ID^ --interactive
# This will open an interactive menu in Vi
sporsh /
Created Nov 22, 2012
Implementation of Android Debug Bridge (ADB) protocol in Twisted
from adb import protocol
data = (

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

# remap prefix to Control + a
nifl / grok_vi.mdown
Created Aug 29, 2011
Your problem with Vim is that you don't grok vi.
View grok_vi.mdown

Answer by Jim Dennis on Stack Overflow question

Your problem with Vim is that you don't grok vi.

You mention cutting with yy and complain that you almost never want to cut whole lines. In fact programmers, editing source code, very often want to work on whole lines, ranges of lines and blocks of code. However, yy is only one of many way to yank text into the anonymous copy buffer (or "register" as it's called in vi).

The "Zen" of vi is that you're speaking a language. The initial y is a verb. The statement yy is a simple statement which is, essentially, an abbreviation for 0 y$:

0 go to the beginning of this line. y yank from here (up to where?)