Skip to content

Instantly share code, notes, and snippets.

Avatar
:bowtie:
Focusing

Weitian LI liweitianux

:bowtie:
Focusing
  • Shanghai, China
View GitHub Profile
@liweitianux
liweitianux / cat-lps.pl
Last active November 18, 2022 02:02
Print lines at particular speed (line/sec)
View cat-lps.pl
#!/usr/bin/env perl
#
# Cat file to terminal at particular speed of lines per second
# https://superuser.com/a/526249
#
# Usage: cat-lps.pl [lps] [file]...
#
use warnings;
use strict;
@liweitianux
liweitianux / ed25519-read-der.c
Last active August 8, 2022 02:17
Convert PEM key to C bytes array
View ed25519-read-der.c
/*-
* Read Ed25519 public and private keys in DER format.
*/
#include <stdio.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/x509.h>
#include "private.h" /* generated by 'pem-to-c.sh' */
@liweitianux
liweitianux / apisix-etcd.md
Last active July 28, 2022 09:34
APISIX etcd configurations
View apisix-etcd.md
@liweitianux
liweitianux / nginx.google.conf
Created July 17, 2021 03:44
Nginx Proxy to Google
View nginx.google.conf
#
# Nginx reverse proxy to Google Search (with images and webcache))
#
# Credit:
# * Nginx rewrite append a parameter at the end of an URL
# https://serverfault.com/a/311660/387898
# * https://github.com/tracycool/Reverse-Proxy-for-Google
# * https://github.com/caiguanhao/nginx-bypass-gfw/blob/master/google.conf
#
# References:
@liweitianux
liweitianux / git-getversion.sh
Created April 27, 2021 04:56
Generate version information based on Git tags/commits
View git-getversion.sh
#!/bin/sh
#
# Generate version information based on Git tags/commits.
#
dirty_mark='+'
usage() {
cat >/dev/stderr <<EOF
usage: ${0##*/} <full|tag|count|commit> [--dirty] [default]
@liweitianux
liweitianux / README.md
Last active October 21, 2020 03:41
DPVS in VirtualBox
View README.md

DPVS in VirtualBox

Environment

  • DPVS version: v1.7.6, v1.8.4
  • Host: Arch Linux
  • VirtualBox: 6.1.2
  • Virtual machines:
    • centos: as the DPVS load balancer
@liweitianux
liweitianux / f-stack.installation.md
Last active July 16, 2020 09:39
F-Stack Installation (custom prefix)
View f-stack.installation.md

F-Stack Installation

  • Author: Weitian LI
  • Date: 2020-07-16

Environment

  • OS: CentOS 7.4.1708
  • Kernel: 3.10.0-957.27.2.el7.x86_64
@liweitianux
liweitianux / keybase.md
Created July 14, 2019 03:29
Keybase proof
View keybase.md

Keybase proof

I hereby claim:

  • I am liweitianux on github.
  • I am liweitianux (https://keybase.io/liweitianux) on keybase.
  • I have a public key ASC-oq97UzToDKQUsTtdvSKy5GVuEHWFx9NZQmOoTYs0TQo

To claim this, I am signing this object:

@liweitianux
liweitianux / dfly-install-hammer2.md
Last active December 24, 2021 01:42
DragonFly BSD Installation (MBR, HAMMER2 boot+root)
View dfly-install-hammer2.md

DragonFly BSD Installation

1. Create Disk Slice

Assume the disk is /dev/da8, to create a slice of about 100 GB.

dfly# cat > fdisk.conf << _EOF_
@liweitianux
liweitianux / fg21sim-plot-example.py
Created September 12, 2018 04:13
Matplotlib example
View fg21sim-plot-example.py
import matplotlib as mpl
import matplotlib.pyplot as plt
# %matplotlib inline
# Matplotlib Customization
# References: https://matplotlib.org/users/customizing.html
# refresh the font cache:
#mpl.font_manager._rebuild()