Skip to content

Instantly share code, notes, and snippets.

南浦月 nanpuyue

Block or report user

Report or block nanpuyue

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
View crc32sum.rs
use std::env;
use std::fs::File;
use std::io::{stdin, Read};
use crc_all::CrcAlgo;
use lazy_static::lazy_static;
const BUFFER_SIZE: usize = 1024 * 16;
fn crc32sum<R: Read>(r: &mut R) -> u32 {
View openvpn-updown.sh
#!/bin/sh
# date: 2019-08-02
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
# author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com
MARK=404
TABLE=404
SETNAME="surfing telegram"
VERBOSE=0
@nanpuyue
nanpuyue / main.go
Last active Jul 12, 2019
simple reverse proxy service on gae
View main.go
// date: 2019-07-12
// license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
// author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com
package main
import (
"bufio"
"golang.org/x/net/context"
"google.golang.org/appengine"
@nanpuyue
nanpuyue / main.go
Last active Jul 13, 2019
simple reverse proxy service
View main.go
// date: 2019-07-12
// license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
// author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com
package main
import (
"log"
"net/url"
"net/http"
View tree.g
// Date: 2010-06-21
// Author: Emden R. Gansner
// From: [graphviz-interest@research.att.com]
BEGIN {
double tw[node_t]; // width of tree rooted at node
double nw[node_t]; // width of node
double xoff[node_t]; // x offset of root from left side of its tree
double sp = 36; // extra space between left and right subtrees
double wd, w, w1, w2;
View static_str_from_string.rs
#![allow(unused_imports)]
use std::mem::{forget, transmute};
use std::slice::from_raw_parts;
use std::str::from_utf8_unchecked;
fn assert_static<T: 'static>(_: T) {}
fn main() {
let str = {
View export-data.rs
use std::env::args;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::str::FromStr;
fn main() {
let mut args = args();
if args.len() == 3 {
args.next();
let interval = u32::from_str(&args.next().unwrap()).unwrap();
View select_delay.rs
// file: select_delay.rs
// date: 2019-04-09
// license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
// author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com
use std::time::{Duration, Instant};
use futures::Future;
use tokio::timer::Delay;
View export_data.sh
#!/bin/bash
# file: export_data.sh
# date: 2019-03-29
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
# author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com
# note:
# sigrok-cli -i xxx.sr -P uart:baudrate=1500000:tx=D3 -A uart=tx-data --protocol-decoder-samplenum
INTERVAL=100
END=0
@nanpuyue
nanpuyue / yubikey-touch-notify
Created Mar 9, 2019
a notifier for yubikey-touch-detector
View yubikey-touch-notify
#!/bin/bash
# file: yubikey-touch-notify
# date: 2019-03-09
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
# author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com
# refer: https://github.com/maximbaz/yubikey-touch-detector
SOCKET="$XDG_RUNTIME_DIR/yubikey-touch-detector.socket"
NOTIFY_ICON="dialog-information"
You can’t perform that action at this time.