Skip to content

Instantly share code, notes, and snippets.

Yifan Gao gaoyifan

Block or report user

Report or block gaoyifan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gaoyifan
gaoyifan / google-fonts-proxy
Last active Apr 25, 2020
google-fonts-proxy
View google-fonts-proxy
server {
listen 80;
listen 443;
listen [::]:80;
listen [::]:443;
server_name fonts.lug.ustc.edu.cn;
access_log /var/log/nginx/revproxy_access.log;
error_log /var/log/nginx/revproxy_error.log;
@gaoyifan
gaoyifan / uml-on-debian.md
Created Nov 21, 2016
User Mode Linux on Debian Jessie
View uml-on-debian.md

User Mode Linux on Debian Jessie

host kernel version: 3.16.36-1+deb8u2

target kernel version: 4.9-rc5

Build UML kernel

Preparation

@gaoyifan
gaoyifan / tc-mark.nft
Created Sep 24, 2018
Traffic control mark with nftables
View tc-mark.nft
#! /usr/sbin/nft -f
chain tc-wan {
# check default priority
mark & 0xff0 == 0x130 ip dscp set af22 return
# real-time application
## Dota2
udp dport 27000-27200 \
meta mark set mark & 0xfffff00f ^ 0x110 ip dscp set af41 return
@gaoyifan
gaoyifan / ubuntu-mount-new-disk.md
Last active Apr 8, 2019
ubuntu 添加新硬盘
View ubuntu-mount-new-disk.md

ubuntu 添加新硬盘

查看硬盘:

# fdisk -l
...
Disk /dev/sdb: 274.9 GB, 274877906944 bytes
255 heads, 63 sectors/track, 33418 cylinders, total 	536870912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
@gaoyifan
gaoyifan / RTAI installation for ubuntu 14.04.md
Last active Mar 17, 2019
RTAI installation for ubuntu 14.04
View RTAI installation for ubuntu 14.04.md

RTAI installation for ubuntu 14.04

Preparation

download and unzip

cd /usr/src
curl -L https://www.rtai.org/userfiles/downloads/RTAI/rtai-4.1.tar.bz2 | tar xj
curl -L https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.32.tar.xz | tar xJ
curl -L http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.10.32-saucy/linux-image-3.10.32-031032-generic_3.10.32-031032.201402221635_amd64.deb -o linux-image-3.10.32-generic-amd64.deb
@gaoyifan
gaoyifan / ramdom-ipv6.sh
Created Sep 11, 2018
Generate random IPv6 address
View ramdom-ipv6.sh
#!/bin/sh
# example: ./ramdom-ipv6.sh 2402:f000:1::/48 166.111.21.1
table_id=436298364
ipv6_cidr=$1
ipv4_addr=$2
ipv6_prefix=$(echo $ipv6_cidr | cut -d / -f 1)
ipv6_sublen=$(echo $ipv6_cidr | cut -d / -f 2)
View certbot-auth-hook.sh
#!/usr/bin/env bash
# require: git version > 2.3
# require: `db/letsencrypt` existed in git repo
if [[ -z "$CERTBOT_DOMAIN" ]] || [[ -z "$CERTBOT_VALIDATION" ]]; then
echo '$CERTBOT_DOMAIN and $CERTBOT_VALIDATION environment variables required.'
fi
source /etc/letsencrypt/dns-auth.conf
View gist:bcaebe9798f09a5b330006b026f9c402
alicdnkk.miaopai.com 2 1.2 1.2
s3-static.lufaxcdn.com 2 1.2 2.4
ali-ind-cdn.kwai.net 2 1.2 3.6
c3.xinstatic.com 2 1.2 4.8
cdn.scdng.com 2 1.2 6.1
jzsite.cdnpe.com 2 1.2 7.3
qncdnbb.miaopai.com 2 1.2 8.5
aliyuncdn-monitortestp-res.mzres.com 2 1.2 9.7
ottvideogs.hifuntv.com 2 1.2 10.9
wylivetest.cdnpe.com 2 1.2 12.1
@gaoyifan
gaoyifan / # sjk - 2017-05-05_23-32-08.txt
Created May 5, 2017
sjk on macOS 10.12.4 - Homebrew build logs
View # sjk - 2017-05-05_23-32-08.txt
Homebrew build logs for sjk on macOS 10.12.4
Build date: 2017-05-05 23:32:08
View chinanet,APNIC-BGP
1.0.1.0/24
1.0.2.0/23
1.0.8.0/21
1.0.32.0/19
1.1.0.0/24
1.1.2.0/23
1.1.4.0/22
1.1.9.0/24
1.1.10.0/23
1.1.12.0/22
You can’t perform that action at this time.