Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
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 ro.build.version.release')}
echo -e "ANDROID_SERIAL=$ANDROID_SERIAL\nro.build.version.release=$TAG" 1>&2
@staltz
staltz / introrx.md
Last active April 24, 2024 19:47
The introduction to Reactive Programming you've been missing
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
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
timyates / Currying.java
Last active March 7, 2020 07:11
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
sporsh / packet-adb.c
Created April 19, 2013 17:26
Android Debug Bridge (ADB) dissector for Wireshark
/*
* packet-adb.c
*
* Routines for Android Debug Bridge (ADB) protocol dissection
* Author: Geir Sporsheim <geir.sporsheim@gmail.com>
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@lolindrath
lolindrath / gist:4454638
Last active January 8, 2020 19:57 — forked from mdb/gist:4288296
How to Amend a Git Commit
# View the log to find the commit you want to edit:
git log
# Quit out of the log
q
# 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
sporsh / parse.py
Created November 22, 2012 00:17
Implementation of Android Debug Bridge (ADB) protocol in Twisted
from adb import protocol
data = (
'\x4f\x50\x45\x4e\x02\x00\x00\x00'
'\x00\x00\x00\x00\x09\x00\x00\x00'
'\x31\x03\x00\x00\xb0\xaf\xba\xb1'
'\x73\x68\x65\x6c\x6c\x3a\x6c\x73'
'\x00'
)
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

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
nifl / grok_vi.mdown
Created August 29, 2011 17:23
Your problem with Vim is that you don't grok vi.

Answer by Jim Dennis on Stack Overflow question http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118

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?)