Skip to content

Instantly share code, notes, and snippets.

View qwIvan's full-sized avatar

yang chanfa qwIvan

View GitHub Profile
@qwIvan
qwIvan / shadowiptables.sh
Last active February 28, 2023 22:57
自动翻墙脚本,配合shadowsocks-libev的ss-redir使用,需要ipset(sudo apt-get install ipset)
#!/bin/bash
#自动翻墙脚本,配合shadowsocks-libev的ss-redir使用。需要ipset
chnroute_file=~/.chnroute
ignore_ips=(
45.32.50.160
45.127.93.239
103.214.68.175
0.0.0.0/8
10.0.0.0/8
127.0.0.0/8
@qwIvan
qwIvan / log.vim
Created June 16, 2016 08:07
Logging every autocommands events in the log file
augroup EventLoggin
autocmd!
autocmd BufNewFile * call s:Log('BufNewFile')
autocmd BufReadPre * call s:Log('BufReadPre')
autocmd BufRead * call s:Log('BufRead')
autocmd BufReadPost * call s:Log('BufReadPost')
autocmd BufReadCmd * call s:Log('BufReadCmd')
autocmd FileReadPre * call s:Log('FileReadPre')
autocmd FileReadPost * call s:Log('FileReadPost')
autocmd FileReadCmd * call s:Log('FileReadCmd')
@qwIvan
qwIvan / service.md
Created December 16, 2017 09:19 — forked from tniessen/service.md
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]

@qwIvan
qwIvan / SslUtil.java
Created October 21, 2015 02:56 — forked from sharonbn/SslUtil.java
SSL/TLS connection from Eclipse Paho Java client to mosquitto MQTT broker
import java.io.*;
import java.nio.file.*;
import java.security.*;
import java.security.cert.*;
import javax.net.ssl.*;
import org.bouncycastle.jce.provider.*;
import org.bouncycastle.openssl.*;
public class SslUtil
// https://regex101.com/r/yX5xS8/74
const html = `
<ImG
sTyle=""
src="http://t.cn/EqRt9Eh"
class=">"
// https://regex101.com/r/yX5xS8/73
const html = `
<ImG
sTyle=""
src="http://t.cn/EqRt9Eh"
class=">"
// https://regex101.com/r/yX5xS8/73
const html = `
<ImG
sTyle=""
src="http://t.cn/EqRt9Eh"
class=">"
--- adb starting (pid 10564) ---
adb I 05-16 11:18:25 10564 10564 main.cpp:57] Android Debug Bridge version 1.0.39
adb I 05-16 11:18:25 10564 10564 main.cpp:57] Version 8.1.0_r7
adb I 05-16 11:18:25 10564 10564 main.cpp:57] Installed as /usr/bin/adb
adb I 05-16 11:18:25 10564 10564 main.cpp:57]
adb I 05-16 11:18:25 10564 10564 adb_auth_host.cpp:416] adb_auth_init...
adb I 05-16 11:18:25 10564 10564 adb_auth_host.cpp:174] read_key_file '/home/ivan/.android/adbkey'...
adb I 05-16 11:18:25 10564 10564 adb_auth_host.cpp:391] adb_auth_inotify_init...
adb I 05-16 11:18:25 10564 10564 adb_auth_host.cpp:467] Calling send_auth_response
adb I 05-16 11:35:34 10564 10564 adb_auth_host.cpp:467] Calling send_auth_response
@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
@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