Skip to content

Instantly share code, notes, and snippets.

View qwIvan's full-sized avatar

yang chanfa qwIvan

View GitHub Profile
@fortuna
fortuna / Queries.md
Last active January 12, 2024 20:03
Grafana dashboard for Outline Servers

Example Queries

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)
@qwIvan
qwIvan / app.py
Created March 26, 2018 09:15 — forked from seanbehan/app.py
Flask with Django ORM
'''
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
@seanbehan
seanbehan / app.py
Last active March 13, 2023 04:55
Flask with Django ORM
'''
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 <zbinlin@outlook.com>
*/
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());
@tniessen
tniessen / service.md
Created October 1, 2016 11:46
Using the "service" tool with ADB and why to avoid it

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]

@zmwangx
zmwangx / qqvdl
Last active June 8, 2019 08:47
v.qq.com SHD downloader (腾讯超清视频下载) https://github.com/soimort/you-get/issues/1298#issuecomment-236489420
#!/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
@qwIvan
qwIvan / web-servers.md
Created April 23, 2016 18:10 — forked from willurd/web-servers.md
Big list of http static server one-liners

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.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@GitaiQAQ
GitaiQAQ / PhuckQQ.md
Created March 2, 2016 12:53
a xposed module for QQbot
  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]");

10 Scala One Liners to Impress Your Friends

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.

1. Multiple Each Item in a List by 2

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

@any0921
any0921 / Roman Hitman
Created January 26, 2016 05:52 — forked from zealic/Email
Please use CAPTCHA as additional message
iUxaTwANChoKEDAgQAlAAQUOMAA9AAAAAFaYvG1WmLxtADKLBZkAAAJmAAACNKu8
wBMAFzJhMzhhNGE5MzE2YzQ5ZTVhODMzNTE3YzQ1ZDMxMDcwIDg2MTM5ODVldAMA
E2I4Zjc1N2FlNjQzOWU4NzliYjJhIHwgUm9tYW4gSGl0bWFuCj0gHgAAAAcKL1Rk
NldGb0FBQVRtMXJSR0FnQWhBUndBQAAAAHRRejFqTTRBRnlBUlZkQUNrSUJFU2l3
VU5uMHF1VVVBRElIZ3kyCjVsU1RROFM3R1ZHcU1TeTBxNUlqbjR1cmFJS05zcjRW
Q2J1WmRhOXllTElEUWZYTkc2UUFpWW1YWmZXQmx5SjQKa2NJTGFHcnAyWkc0d1NY
dzUzaEJyOHNQd1RRb1B1QjNsTGtySEdWV2N5OFZxMklRUGlnaTU0d3dZNGpJVFpi
dgpudmwxOFNJYWtvOWsyZUhGd3h6SXY0b1BJWG1zeXRiQmRWZVVhTStFTzQwbm1J
UkthTk9SNzFNZUROZkxVQmFkCmdHa2RnM2t2alRPa0xwNkJiSWMzOS9icm1yTzBH
Z1ZhdUQ1WHRHVU5CdHJ2aTBlemRSSlJGcldxT1N1SkdKd2UKTWRsNVJrMTdidFc3