Skip to content

Instantly share code, notes, and snippets.

Working from home

Ruipeng Zhang ppoffice

Working from home
View GitHub Profile
ppoffice / xstartup
Last active Apr 24, 2022
VNC xstartup for Ubuntu Desktop (Gnome)
View xstartup
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
vncconfig -iconic &
export DESKTOP_SESSION=/usr/share/xsessions/ubuntu.desktop
export XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
dbus-launch --exit-with-session /usr/bin/gnome-session --systemd --session=ubuntu
ppoffice /
Last active Apr 28, 2022
A step by step guide to upgrade webview on an old Android Emulator


  1. emulator (30.3.5) (via Android SDK)
  2. adb (30.0.5) (via Android SDK)
  3. apktool (2.5.0) and Java runtime
  4. zip (3.0)
  5. unzip (6.0)

Make sure you have JAVA_HOME and ANDROID_HOME environment variables correctly set.

ppoffice /
Last active Jun 30, 2022
Install Visual Studio Code (actually code-server) on Android
  1. Install Termux, an Android terminal emulator that provides a Linux execution environment and various tools.

  2. Update system packages in Termux:

    $ pkg update -y
ppoffice / cem_v1_to_v2.cpp
Created Apr 25, 2020
Convert Empire Earth CEM v1 model to v2 model
View cem_v1_to_v2.cpp
// Copyright 2020 ppoffice
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this softwareand 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 :
// The above copyright noticeand this permission notice shall be included in
ppoffice / config.example.yaml
Last active Jan 10, 2020
Sectry Scenario Specs
View config.example.yaml
version: 1.0.0
- id: 637548c3-b5db-4ee2-94e6-e93bbb693eac
name: Default Security Group
- Ingress TCP 80
- Ingress TCP 443
- Egress
ppoffice /
Last active Nov 4, 2019
LG Nexus 5 Ubuntu Xfce4 Desktop with X11 fbdev and evdev
# recompile kernel first with patch:
git clone \
-b marshmallow-mr1-release \
git clone \
-b android-msm-hammerhead-3.4-marshmallow-mr1 \
git clone ~/mkbootimg
cd ~/msm
ppoffice /
Last active Aug 20, 2021
Textbook/RAW RSA & RSA with OAEP+SHA1+MGF1 Python Implementation
from typing import Tuple
import pyasn1.codec.der.encoder
import pyasn1.type.univ
import base64
import rsa
def private_key_pem(n: int, e: int, d: int, p: int, q: int, dP: int, dQ: int, qInv: int) -> str:
'''Create a private key PEM file
ppoffice /
Last active Oct 2, 2021
How to setup a Mirai testbed


  • CNC Server: (cnc.local:23)
  • Report Server: (cnc.local:48101)
  • Loader Server:
  • Bot Binary Host:*

Hosts Setup


ppoffice /
Last active May 6, 2022
LXC for Android 9.0.0 r18 Goldfish

Steps to build Android kernel and system for LXC:

  1. Download Android SDK, NDK, system and kernel source code;
  2. Download modified lxc and libcap source code (ppoffiec/lxc-android, ppoffice/libcap-android)
  3. Build Android system from source first so that we can link to its shared library when we build lxc (or maybe we don't have to);
  4. Modify Android kernel config and make sure lxc-checkconfig does not report any missing features. Then build kernel;
  5. Modify Android system/core/rootdir/init.rc according to init.rc.diff. Make sure you mount all the cgroup subsystems needed (cpu, cpuacct, cpuset, memory, pids, devices, freezer, blkio) under /sys/fs/cgruop, otherwise lxc won't find them;
  6. Rebuilt the Android system image so that the modified init.rc is in the image;
  7. Fire up the emulator with custom kernel (emulator -kernel kernel-file-path) and use adb shell and dmesg to check if everything is doing ok.
View gist:2706b5e4448e8a3638c974e64c88c2ad
# Get Pre-reqs
apt-get install libattr1-dev git unzip make gcc automake pkg-config
# Get Android NDK
cd /root
mkdir -p build && cd build
wget -O /tmp/
unzip /tmp/ -d /root/build
# Set paths