Skip to content

Instantly share code, notes, and snippets.

@jkubacki
jkubacki / gist:e2dd904bd648b0bd4554
Created January 21, 2015 18:47
Mac uninstall elasticsearch
#!/usr/bin/env sh
# checks to see if running
launchctl list | grep elasticsearch
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
launchctl remove homebrew.mxcl.elasticsearch
pkill -f elasticsearch
@Trinea
Trinea / DigestUtils
Last active January 4, 2016 15:49
get md5 and sha1 of file
System.out.println(org.apache.commons.codec.digest.DigestUtils.md5Hex(new FileInputStream("E:\\trinea-android-demo.apk")));
System.out.println(org.apache.commons.codec.digest.DigestUtils.sha1Hex(new FileInputStream("E:\\trinea-android-demo.apk")));
System.out.println(org.apache.commons.codec.digest.DigestUtils.sha512Hex(new FileInputStream("E:\\trinea-android-demo.apk")));
download url: http://commons.apache.org/proper/commons-codec/download_codec.cgi
api guide: http://commons.apache.org/proper/commons-codec/apidocs/org/apache/commons/codec/digest/DigestUtils.html
@JakeWharton
JakeWharton / HierarchyTreeChangeListener.java
Last active March 16, 2022 02:17
A hierarchy change listener which recursively monitors and entire tree of views. Apache 2.
import android.view.View;
import android.view.ViewGroup;
/**
* A {@link ViewGroup.OnHierarchyChangeListener hierarchy change listener} which recursively
* monitors an entire tree of views.
*/
public final class HierarchyTreeChangeListener implements ViewGroup.OnHierarchyChangeListener {
/**
* Wrap a regular {@link ViewGroup.OnHierarchyChangeListener hierarchy change listener} with one
@devunwired
devunwired / GifDecoder.java
Last active January 26, 2024 21:14
An optimized implementation of GifDecoder for Android devices.
/**
* Copyright (c) 2013 Xcellent Creations, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
@coldnebo
coldnebo / Default (Linux).sublime-keymap
Created August 10, 2011 23:20
simple scripts to prettify your xml and json in sublime text 2
[
{ "keys": ["ctrl+shift+x"], "command": "tidy_xml" },
{ "keys": ["ctrl+shift+j"], "command": "prettify_json" }
]
@marshall
marshall / ClassLoaderActivity.java
Created February 22, 2011 17:16
A reflection hack to override the APK ClassLoader so you can launch Activities in an external JAR.
//
// !!WARNING: Not recommended for production code!!
//
public class ClassLoaderActivity extends Activity
{
public void onCreate(Bundle savedInstanceState)
{
// file.jar has a dex'd "classes.dex" entry that you can generate with "dx" from any number of JARs or class files
ClassLoader dexLoader = new DexClassLoader("/path/to/file.jar", getCacheDir().getAbsolutePath(), null, getClassLoader());
setAPKClassLoader(dexLoader);