Skip to content

Instantly share code, notes, and snippets.

View spudtrooper's full-sized avatar

Jeff Palm spudtrooper

View GitHub Profile
@spudtrooper
spudtrooper / dexclasses
Created October 21, 2011 14:47
Prints out the classes in a dex file
#!/bin/sh
dexdump "$@" | awk -F\' '/Class descriptor/ {print $2}' | sed -e 's/^L//g' -e 's/;$//g' -e 's/\//./g'
@spudtrooper
spudtrooper / jar2java
Created October 31, 2011 13:45
Generates java source from a jar file (e.g. for use in javadoc)
#!/bin/sh
#
# Transforms a jar file into source and outputs source files to 'src'.
# Example:
#
# jar2java foo.jar ; --> source to 'src'
#
# After you can run javadoc on these files, e.g.
#
# javadoc -classpath foo.jar -d api `find src -name "*.java"`
@spudtrooper
spudtrooper / jenkins.html
Created November 30, 2011 13:37
A bookmarklet to monitor a Jenkins build page, and play the theme from golden girls when the build breaks and play the theme from arrested development when the build is fixed.
<a href='javascript:(function(){function k(r,q){for(var p in q){r.style[p]=q[p]}}function c(r,q){var p=document.createTextNode(r);if(q){q.appendChild(p)}return p}function e(p,s,r){var q=document.createElement(p);if(s){s.appendChild(q)}if(r){k(q,r)}return q}function j(q){try{console.log(q)}catch(p){}}function l(p){while(p.childNodes.length>0){p.removeChild(p.firstChild)}}function m(p){this.name=p;this.callbacks=[]}m.prototype={addListener:function(p){this.callbacks.push(p)},notifyListeners:function(r){var p=this.callbacks;j("notify "+p.length+" ["+this.name+"]("+r+")");for(var q=0;q<p.length;q++){p[q](r)}}};var n={None:"None",Success:"Success",Fail:"Fail",Pending:"Pending"};function d(){this.lastState=n.None;this.state=n.None;this.stateChangeEvent=new m("Change")}d.prototype={setState:function(p){this.lastState=this.state;this.state=p;j(this.lastState+" -> "+this.state);if(this.lastState!=this.state){this.stateChangeEvent.notifyListeners(this)}},getState:function(){return this.state},getLastState:function(){re
@spudtrooper
spudtrooper / adb_colorize.rb
Created December 7, 2011 21:06
Colorize logcat output
#!/usr/bin/env ruby
#
# Colorizes adb output, e.g.
#
# adb logcat | adb_colorize
#
ESC = "\033"
CLOSE = ESC + '[0m'
def color(c)
@spudtrooper
spudtrooper / ycombinatorPoll.html
Created December 8, 2011 13:41
Bookmarklet to add colored histograms to polls on news.ycombinator.org
<a href='javascript:(function(){const d=75;function c(h,g){for(var f in g){h.style[f]=g[f]}}function b(j,g,h,f,i){i=i||j/2;return Math.floor(j-i*(f-g)/(f-h))}function e(q,g,l,p){var o=b(d,g,l,p);var k=b(255,g,l,p,238);var j="#"+k.toString(16)+"0000";var h=q.parentNode;h.appendChild(document.createTextNode(" "));var f=document.createElement("span");h.appendChild(f);var r={height:"100%","background-color":j,color:j};var n="";for(var m=0;m<o;m++){n+="|"}f.innerHTML=n;c(f,r);console.log(f)}function a(){var l=document.getElementsByTagName("span");var g=[];function q(i,p){return{span:i,score:p}}var j;var n;for(var k in l){var o=l[k];if(!o.id||!o.id.match(/score_/)){continue}var h=parseInt(o.innerHTML.match(/(\d+) /)[0]);if(!j||h<j){j=h}if(!n||h>n){n=h}g.push(q(o,h))}var m="";for(var k in g){if(k==0){continue}var f=g[k];e(f.span,f.score,j,n)}}a()})();'>ycombinator polls</a>
@spudtrooper
spudtrooper / dex_dups.sh
Created December 14, 2011 18:56
Lists the offending class names in stacktraces created from assemlbing an APK when there are multiple class definitions.
#!/bin/sh
#
# Lists the offending class names in stacktraces created from
# assemlbing an APK when there are multiple class definitions.
#
awk '/already added/ { print $4 }' | sed -e 's/;//g' -e 's/^L//g' -e 's/\//./g'
@spudtrooper
spudtrooper / find_duplicated_jars.rb
Created December 15, 2011 13:54
Prints out the duplicated classes found in the passed in jars...helpful finding library include problems in Android projects
#!/usr/bin/env ruby
#
# Prints out the duplicated classes in jars
#
# Example:
#
# find_duplicated_jars *.jar
#
@spudtrooper
spudtrooper / orangefr.user.js
Created January 1, 2012 13:10
Bypasses the log in screen for orange.fr wifi
// ==UserScript==
// @name Ornage FR
// @namespace http://jeffpalm.com/orangefr
// @description Bypasses the log in screen for orange.fr wifi
// @include https://hautdebitmobile.orange.fr:8443/home*
// ==/UserScript==
(function() {
function main() {
var els;
@spudtrooper
spudtrooper / blackout.user.js
Created January 18, 2012 13:35
Blacks out MPAA, RIAA, and other sites
// ==UserScript==
// @name Blackout MPAA and RIAA sites
// @namespace http://jeffpalm.com/blackout
// @description Blacks out MPAA ad RIAA and possibly others
// @include http://riaa.com*
// @include http://mpaa.org*
// ==/UserScript==
(function() {
var html = '<style>p{color:#000;}</style><div id="sopa-wrapper" style="z-index:1001;background:#000;-moz-opacity:0.9;filter:alpha(opacity=90);opacity:0.9;position:absolute;top:0;left:0;width:100%;height:100%;margin:0;padding:0;">';
@spudtrooper
spudtrooper / google-duckduckgo.user.js
Created February 13, 2012 14:19
Redirects google searches starting with bang to duckduckgo.com. This way you can keep google (or whatever) as your default search engine so that when you 'cat' in the address bar, google is searched. But, when you type '!yt cat', youtube is searched, bec
// ==UserScript==
// @name Google + DuckDuckGo
// @namespace http://jeffpalm.com/googleduckduckgo/
// @description Redirects google searches starting with bang to duckduckgo.com
// @include https://www.google.com/*
// @include http://www.google.com/*
// ==/UserScript==
(function() {