1h active keys by location:
sum(max(increase(shadowsocks_data_bytes{access_key!=""} [1h])) by (access_key, location) > bool 0) by (location)
1h usage by location:
sum(increase(shadowsocks_data_bytes{dir=~"c<p|p>t"} [1h])) by (location)
''' | |
Run the following commands (bc. gists don't allow directories) | |
pip install flask django dj-database-url psycopg2 | |
mkdir -p app/migrations | |
touch app/__init__.py app/migrations/__init__.py | |
mv models.py app/ | |
python manage.py makemigrations | |
python manage.py migrate |
''' | |
Run the following commands (bc. gists don't allow directories) | |
pip install flask django dj-database-url psycopg2 | |
mkdir -p app/migrations | |
touch app/__init__.py app/migrations/__init__.py | |
mv models.py app/ | |
python manage.py makemigrations | |
python manage.py migrate |
/** | |
* For Google Voice | |
* @Author zbinlin <[email protected]> | |
*/ | |
var sleep = delay => new Promise(resolve => setTimeout(resolve, delay)); | |
var composeClick = function x(btn) { | |
var rect = btn.getBoundingClientRect(); | |
var x = Math.floor(rect.clientX + rect.width * Math.random()); | |
var y = Math.floor(rect.clientY + rect.height * Math.random()); |
As it turns out, it is not trivial to control the audio volume of an Android device using ADB. At the time of writing, the only way appears to be using the service
tool. Actually, the service
command allows to "connect" to a number of services (104 on Android 6.0.1) and invoke functions. Not knowing much about this tool, I managed to completely mute all sounds and speakers of my Nexus 5, and I was stuck without any sound for quite some time. I did not find a way to unmute the sound from within the system UI, so I got to dive a little deeper into this.
If you know which service you want to use, you then need to find its interface declaration. The command
service list
gives you a list of all services with the associated interfaces, if applicable:
...
26 backup: [android.app.backup.IBackupManager]
#!/usr/bin/env zsh | |
print_progress () print -R $'\e[32m'"$*"$'\e[0m' >&2 | |
print_error () print -R $'\e[31m'"Error: $*"$'\e[0m' >&2 | |
# Obvious parameters | |
vid=f00213kcpwl | |
defn=shd | |
# To be extracted from browser's network inspector |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
private void a1405(final XC_LoadPackage.LoadPackageParam lpparam) throws ClassNotFoundException,NoSuchFieldException,IllegalAccessException{
String className = "com.tencent.mobileqq.activity.ChatActivity";
String methodName = "a";
Class<?> message = lpparam.classLoader.loadClass("com.tencent.mobileqq.app.message.QQMessageFacade$Message");
XposedBridge.log("Hooking a(QQMessageFacade$Message qQMessageFacade$Message)[1405]");
Here are 10 one-liners which show the power of scala programming, impress your friends and woo women; ok, maybe not. However, these one liners are a good set of examples using functional programming and scala syntax you may not be familiar with. I feel there is no better way to learn than to see real examples.
Updated: June 17, 2011 - I'm amazed at the popularity of this post, glad everyone enjoyed it and to see it duplicated across so many languages. I've included some of the suggestions to shorten up some of my scala examples. Some I intentionally left longer as a way for explaining / understanding what the functions were doing, not necessarily to produce the shortest possible code; so I'll include both.
The map
function takes each element in the list and applies it to the corresponding function. In this example, we take each element and multiply it by 2. This will return a list of equivalent size, compare to o
iUxaTwANChoKEDAgQAlAAQUOMAA9AAAAAFaYvG1WmLxtADKLBZkAAAJmAAACNKu8 | |
wBMAFzJhMzhhNGE5MzE2YzQ5ZTVhODMzNTE3YzQ1ZDMxMDcwIDg2MTM5ODVldAMA | |
E2I4Zjc1N2FlNjQzOWU4NzliYjJhIHwgUm9tYW4gSGl0bWFuCj0gHgAAAAcKL1Rk | |
NldGb0FBQVRtMXJSR0FnQWhBUndBQAAAAHRRejFqTTRBRnlBUlZkQUNrSUJFU2l3 | |
VU5uMHF1VVVBRElIZ3kyCjVsU1RROFM3R1ZHcU1TeTBxNUlqbjR1cmFJS05zcjRW | |
Q2J1WmRhOXllTElEUWZYTkc2UUFpWW1YWmZXQmx5SjQKa2NJTGFHcnAyWkc0d1NY | |
dzUzaEJyOHNQd1RRb1B1QjNsTGtySEdWV2N5OFZxMklRUGlnaTU0d3dZNGpJVFpi | |
dgpudmwxOFNJYWtvOWsyZUhGd3h6SXY0b1BJWG1zeXRiQmRWZVVhTStFTzQwbm1J | |
UkthTk9SNzFNZUROZkxVQmFkCmdHa2RnM2t2alRPa0xwNkJiSWMzOS9icm1yTzBH | |
Z1ZhdUQ1WHRHVU5CdHJ2aTBlemRSSlJGcldxT1N1SkdKd2UKTWRsNVJrMTdidFc3 |