Skip to content

Instantly share code, notes, and snippets.

task androidJar(type:Exec) {
commandLine = ['jar', 'cf', 'build/EmailChecker.jar', '-C', 'build/classes/release', '.', 'libs/native-libs-0.1.jar']
}
@maxme
maxme / ndk-build.gradle
Created November 12, 2013 17:21
A gradle build file for Android NDK - uses a trick to put *so files in a jar and add that jar as a project dependency
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
function reduce_tqr_time_font_size() {
var a = document.querySelectorAll("tr span");
var i = 0;
for (i = 0; i < a.length; i++) {
a[i].setAttribute("style", "font-size: 0.7em");
}
}
@maxme
maxme / lang_detection.py
Created November 1, 2013 16:31
Language detection algorithm
from collections import defaultdict
def detect_language(scores, input_str):
tokens = input_str.split()
results = defaultdict(int)
for token in tokens:
if token in scores:
language, score = scores[token][0]
results[language] += score
max_lang, max_score = max(results.items(), key=lambda x:x[1])
@maxme
maxme / up.plugin.sh
Last active December 25, 2015 02:39
Quick and dirty up completion for zsh
_up () {
compadd $(up -h|grep " "|tr -s " "|tr "," "\n"|sed -E "s/ ([a-zA-Z-]+)[ ,].*/\1/")
_arguments -s "*:files:_files"
}
compdef _up up
@maxme
maxme / get_balance.py
Created May 22, 2013 14:54
get_balance electrum script
#!/usr/bin/env python
import sys
from electrum import Interface
from electrum import bitcoin, Transaction
def get_transactions(addr):
interface = Interface({'server':'electrum.be:50001:t'})
interface.start()
deps="$(find . -iname "build.gradle" | xargs grep 'compile ' | grep -v project | sed -E "s/.*'(.*)'.*/\1/" | sort | uniq)"
function printTemplate() {
cat << EOF
remote_file(
name = '$1-file',
out = '$2',
url = 'mvn:$4:$1:aar:$3',
sha1 = '0ec99fae8716984ec56489fb45d1ae752724bae7',
)
import random
import requests
import os
from urllib import request
from bs4 import BeautifulSoup
from multiprocessing import Pool
base_url = "http://imgur.com"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="24dp"
android:paddingRight="16dp">
<View
android:background="@android:color/holo_red_dark"
android:id="@+id/my_site_list_row_empty_icon"
#!/bin/sh
# Example inputs:
# dashicon_admin_site 
# dashicon_admin_users 
# dashicon_lock 
# dashicon_edit 
# dashicon_email 
if [ x$2 == x ]; then