Install dependencies
sudo apt-get install libdb4.2-ruby1.8 libcairo-ruby1.8Install Philesight
git clone https://github.com/phunehehe/philesight.git| <?php | |
| /** | |
| * imageColor | |
| * | |
| * Shows three methods to find the 'average' image color. | |
| * | |
| * Each function expects a gd image object. | |
| * | |
| * imageColor::averageResize($image) resizing to 1px, and checking the color. | |
| * imageColor::averageBorder($image) find the average color of all border pixels. |
| # | |
| # Wide-open CORS config for nginx | |
| # | |
| location / { | |
| if ($request_method = 'OPTIONS') { | |
| add_header 'Access-Control-Allow-Origin' '*'; | |
| # |
| L.TileLayer.TileJSON = L.TileLayer.Canvas.extend({ | |
| options: { | |
| debug: false | |
| }, | |
| tileSize: 256, | |
| initialize: function (options) { | |
| L.Util.setOptions(this, options); |
| /* Implementation of HTML Timers (setInterval/setTimeout) based on sleep. | |
| * | |
| * This file is provided under the following terms (MIT License): | |
| * 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: | |
| * |
| <!-- http://frank.zinepal.com/unsign-a-jar-with-ant --> | |
| <macrodef name="unsignjar"> | |
| <attribute name="jar"/> | |
| <sequential> | |
| <!-- Remove any existing signatures from a JAR file. --> | |
| <tempfile prefix="usignjar-" destdir="${java.io.tmpdir}" property="temp.file"/> | |
| <echo message="Removing signatures from JAR: @{jar}"/> | |
| <mkdir dir="${temp.file}"/> |
Install dependencies
sudo apt-get install libdb4.2-ruby1.8 libcairo-ruby1.8Install Philesight
git clone https://github.com/phunehehe/philesight.git| function dex-method-count() { | |
| cat $1 | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"' | |
| } | |
| function dex-method-count-by-package() { | |
| dir=$(mktemp -d -t dex) | |
| baksmali $1 -o $dir | |
| for pkg in `find $dir/* -type d`; do | |
| smali $pkg -o $pkg/classes.dex | |
| count=$(dex-method-count $pkg/classes.dex) | |
| name=$(echo ${pkg:(${#dir} + 1)} | tr '/' '.') |
| // assumes you add a timestamp field to each record (see Firebase.ServerValue.TIMESTAMP) | |
| // pros: fast and done server-side (less bandwidth, faster response), simple | |
| // cons: a few bytes on each record for the timestamp | |
| var ref = new Firebase(...); | |
| ref.orderByChild('timestamp').startAt(Date.now()).on('child_added', function(snapshot) { | |
| console.log('new record', snap.key()); | |
| }); |
| # | |
| # Wide-open CORS config for nginx | |
| # | |
| location / { | |
| if ($request_method = 'OPTIONS') { | |
| add_header 'Access-Control-Allow-Origin' '*'; | |
| # |
| sudo apt-get install python-software-properties | |
| sudo add-apt-repository ppa:webupd8team/java | |
| sudo apt-get update | |
| sudo apt-get install oracle-jdk7-installer | |
| sudo update-alternatives --config java | |
| export JAVA_HOME=/usr/lib/jvm/java-7-oracle/jre/bin/java |