Skip to content

Instantly share code, notes, and snippets.

View xdtianyu's full-sized avatar
🏠
Working from home

tianyu xdtianyu

🏠
Working from home
View GitHub Profile
@xdtianyu
xdtianyu / railgun-arch-install.zsh
Created May 5, 2019 03:07 — forked from typcn/railgun-arch-install.zsh
Install cloudflare railgun on ArchLinux
#!/usr/bin/zsh
mkdir rg-install
cd rg-install
wget http://pkg.cloudflare.com/dists/xenial/railgun/binary-amd64/Packages.gz
gunzip Packages.gz
wget "http://pkg.cloudflare.com/${$(cat Packages | grep Filename:)//Filename: }"
ar -x *.deb
tar xvf data.tar.xz
rm -rf /usr/local/railgun
mkdir -p /usr/local/railgun
@xdtianyu
xdtianyu / jacoco.gradle
Created August 21, 2018 07:45 — forked from bhargavms/jacoco.gradle
A gradle plugin for checking test coverage using jacoco.
apply plugin: 'jacoco'
jacoco {
toolVersion "0.7.1.201405082137"
reportsDir = file("$buildDir/intermediates/test")
}
// Taken from https://blog.gouline.net/2015/06/23/code-coverage-on-android-with-jacoco/
project.afterEvaluate {
// Grab all build types and product flavors
def buildTypes = android.buildTypes.collect { type -> type.name }
@xdtianyu
xdtianyu / .gitlab-ci.yml
Created August 16, 2018 02:19 — forked from danielgomezrico/.gitlab-ci.yml
Android / Gitlab ci - sample setup files to setup your own local gitlab runner with real physical android devices. Check https://github.com/caipivara/awesome-android-scripts
stages:
- build
- test
- deploy
variables:
GIT_STRATEGY: clone
cache:
key: ${CI_PROJECT_ID}
@xdtianyu
xdtianyu / iptables.ash
Created February 16, 2018 23:36 — forked from pagxir/iptables.ash
share vpn over tethering for android 4.4+
#!/system/bin/sh
# log -t IPTABLES -- $@
# iptables -w -t mangle -A INPUT -i tun0 -j MARK --set-mark 0x3006a
IPTABLES="/system/bin/iptables.oem iptables"
need_arg=0;
last_cmd="";
IIF=""
@xdtianyu
xdtianyu / vm-backup.sh
Created May 15, 2017 12:17 — forked from cabal95/vm-backup.sh
I use this script to backup my QEMU/KVM/libVirt virtual machines. The script requires KVM 2.1+ since it uses the live blockcommit mode. This means the data in the snapshot disk is rolled back into the original instead of the other way around. Script does NOT handle spaces in paths.
#!/bin/bash
#
BACKUPDEST="$1"
DOMAIN="$2"
MAXBACKUPS="$3"
if [ -z "$BACKUPDEST" -o -z "$DOMAIN" ]; then
echo "Usage: ./vm-backup <backup-folder> <domain> [max-backups]"
exit 1
#!/bin/bash
#
# vlmcsd - this script starts and stops the vlmcsd-server daemon
#
# Run level information:
# chkconfig: 2345 99 99
# description: KMS Emulator in C
# processname: vlmcsd
# Source function library
@xdtianyu
xdtianyu / README.md
Created June 23, 2016 07:02 — forked from ringe/README.md
KVM QCOW2 Live backup

Live backup of KVM virtual machines

This script will let you make backups of live VMs running on KVM, using libvirt.

The backup job will suspend the VM for the time it takes to copy the RAM to disk.

Credits: Luca Lazzeroni

I've made some minor adjustments.

@xdtianyu
xdtianyu / reflect.py
Created May 27, 2016 09:40 — forked from huyng/reflect.py
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):