Skip to content

Instantly share code, notes, and snippets.

@gaoyifan
gaoyifan / ramdom-ipv6.sh
Created September 11, 2018 01:52
Generate random IPv6 address
#!/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)
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 15:37
sjk on macOS 10.12.4 - Homebrew build logs
Homebrew build logs for sjk on macOS 10.12.4
Build date: 2017-05-05 23:32:08
@gaoyifan
gaoyifan / chinanet,APNIC-BGP
Created February 26, 2017 11:26
BGP vs APNIC IP list
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
@gaoyifan
gaoyifan / ubuntu-install-RTT-base-on-RTAI.md
Last active October 27, 2016 11:09
RTT installation for ubuntu14.04 base on RTAI kernel

RTT installation for ubuntu14.04 base on RTAI kernel

install requirement (assuming that use the image I provided)

apt-get install build-essential cmake libxerces-c2-dev omniorb libboost-all-dev doxygen

get RTT source

cd /usr/src
git clone git://gitorious.org/orocos-toolchain/rtt.git

add environment varible

export RTAI_ROOT_DIR=/usr/realtime
export RTAI_INCLUDE_DIR=$RTAI_ROOT_DIR/include

export RTAI_LIBRARY=$RTAI_ROOT_DIR/lib

[ 0.573915] pci 0000:00:1a.0: reg 0x20: [io 0x9e80-0x9e9f]
[ 0.574011] pci 0000:00:1a.0: System wakeup disabled by ACPI
[ 0.574059] pci 0000:00:1a.1: [8086:3a38] type 00 class 0x0c0300
[ 0.574098] pci 0000:00:1a.1: reg 0x20: [io 0x9e20-0x9e3f]
[ 0.574194] pci 0000:00:1a.1: System wakeup disabled by ACPI
[ 0.574240] pci 0000:00:1a.2: [8086:3a39] type 00 class 0x0c0300
[ 0.574280] pci 0000:00:1a.2: reg 0x20: [io 0x9dc0-0x9ddf]
[ 0.574373] pci 0000:00:1a.2: System wakeup disabled by ACPI
[ 0.574429] pci 0000:00:1a.7: [8086:3a3c] type 00 class 0x0c0320
[ 0.574449] pci 0000:00:1a.7: reg 0x10: [mem 0xfaaf6000-0xfaaf63ff]

Keybase proof

I hereby claim:

  • I am gaoyifan on github.
  • I am ylgaoyifan (https://keybase.io/ylgaoyifan) on keybase.
  • I have a public key whose fingerprint is 9729 B528 F023 EBA7 C4FE 8318 50E3 DB81 7CCE F878

To claim this, I am signing this object:

@gaoyifan
gaoyifan / joinMP4
Created December 26, 2013 12:17
append lots of mp4 in one mp4 file
file=`find . -name '*.mp4' | sed 's/^\.\// -cat "/g' | tr '\n' '"'`
#echo $file
echo "MP4Box $file output.mp4" | bash
package main
import (
"bytes"
"encoding/binary"
"fmt"
"image/png"
"os"
)
@gaoyifan
gaoyifan / getCPUtime.cpp
Created June 18, 2014 12:46
getCPUtime
long long getCPUtime()
{
unsigned int time_low,time_high;
asm("rdtsc \n\t");
asm("movl %%eax, %0\n\t":"=g"(time_low));
asm("movl %%edx, %0\n\t":"=g"(time_high));
return ((long long)time_high << 32) | time_low;
}