Dizzy Dream of Android Development

These are my personal notes.

Sign APK

1. Generate Keystore (Only Once)

keytool -genkey -v -keystore chaos.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias app

2. Zipalign

/home/chaos/Android/Sdk/build-tools/26.0.1/zipalign -p -v 4 '/home/chaos/Websites/App/chaos/app-release.apk' '/home/chaos/Websites/App/chaos/chaos-1.0.6-aligned.apk'

3.Sign & Verify

The script file can be found in %ANDROID_HOME%/sdk/build-tools/24.0.3/ (the .jar is in the /lib subfolder). Use it like this

/home/chaos/Android/Sdk/build-tools/26.0.1/apksigner sign --ks '/home/chaos/.apkstudio/vendor/chaos.keystore' --out '/home/chaos/Websites/Nethunter/themes/Dreamhunter/source/app/download/chaos-1.0.6.apk'  '/home/chaos/Websites/App/chaos/chaos-1.0.6-aligned.apk' 

Verify:

/home/chaos/Android/Sdk/build-tools/26.0.1/apksigner verify '/home/chaos/Websites/App/chaos/chaos-1.0.6.apk'

Read More

Kick Other SSH Clients on Linux

Show Online Users:

[root@test ~]# w

00:41:47 up 15 min,  2 users,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0    162.16.16.155    00:28    8:42   0.07s  0.07s -bash
root     pts/1    1162.16.16.156   00:41    0.00s  0.02s  0.00s w

Show which is this connected client:

[root@test ~]# who am i

root pts/0 2013-12-31 14:30 (162.16.16.155)

pkill others:

[root@test ~]# pkill -kill -t pts/1

Check again:

[root@test ~]# w

00:42:12 up 16 min,  1 user,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0    162.16.16.155   00:28    4.00s  0.02s  0.00s w

Notice:

If the other users are not disconnected, I suggest you kill the connection forcely:

[root@test ~]# pkill -9 -t pts/1

一个人的安静体验

能认真听呼吸声时,我才发现一只总想忙碌下去的自己。

一个人一生里,没什么事情、不需要工作不需要学习不需要照顾不需要陪伴的时间很少,能自己无事,不看电视手机、不去聊天刷动态的时候真的很少。一个人安静地、不紧不慢地思考的时间,很少。

你能做一个没有别人的白日梦吗?白日梦里,多少还会有别人吧。

人要是没有任何交际,脑海里不对任何人有任何的期许和想象——甚至需要的话,这应该是一个神,而不是一个人。

生活里就是充斥着别人的影子,或是,生活是由别人的影子织好的。

想幸福快乐吗?那就必须看破这荒谬欺人的幻象。

想有安全感吗?唯有对自己诚实如一,才能让扎实的感觉成长。

思想的草原上荒芜人烟,像一场大梦一样。

Enable BBR on Debian Stretch

BBR(Bottleneck Bandwidth and RTT) is a new congestion control algorithm for TCP released by Google. It’s added into Linux kernel since 4.9. Instead of regarding packet loss as the signal of congestion, BBR sequentially probes the bottleneck bandwidth and RTT.

Check if the kernel supports BBR:

uname -r    # kernel >= 4.9

After that, use lsmod | grep bbr to test if the output has the word “bbr“. If not:

modprobe tcp_bbr
echo "tcp_bbr" >> /etc/modules-load.d/modules.conf

Execute these commands:

echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p

Test:

sysctl net.ipv4.tcp_available_congestion_control
sysctl net.ipv4.tcp_congestion_control