This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/target | |
Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// date: 2022-04-24 | |
// license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt | |
// author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com | |
use std::fmt::{self, Debug, Display, Formatter}; | |
use std::iter::Peekable; | |
use std::str::Lines; | |
use std::{error, result}; | |
use serde::de::{self, Visitor}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::marker::PhantomData; | |
#[derive(Debug)] | |
struct S<'a> { | |
_pd: PhantomData<&'a mut &'a ()> | |
} | |
impl<'a> Drop for S<'a> { fn drop(&mut self) {} } | |
impl<'a> S<'a> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct S<'a> { | |
a: &'a (), | |
} | |
impl<'a> S<'a> { | |
fn feed(&self, data: &'a [u8]) { | |
drop(data); | |
} | |
fn get_a(&self) -> &() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let url = $request.url; | |
let body = $request.body; | |
url = url.replace(/&sim_code=[0-9]+/g,''); | |
body = body.replace(/&sim_code=[0-9]+/g,''); | |
$done({url, body}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# (c) 2016 nanpuyue <nanpuyue@gmail.com> | |
# usage:sudo ./live_initrd_on_exfat.sh deepin-15.3-amd64.iso | |
NAMESERVER="1.2.4.8" | |
EXFAT_BIN="sbin/mount.exfat" | |
FILE_LIST="sbin/mount.exfat sbin/mount.exfat-fuse lib/x86_64-linux-gnu/libfuse.so.*" | |
ISO=$(readlink -f "$1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// date: 2020-07-06 | |
// license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt | |
// author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <arpa/inet.h> | |
#include <fcntl.h> | |
#include <sys/epoll.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# date: 2019-01-02 | |
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt | |
# author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com | |
def sha2_iv(n: int) -> int: | |
square_root = pow(n, 1/2) | |
decimal = square_root - int(square_root) | |
return int(decimal * 0x100000000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// date: 2019-01-09 | |
// license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt | |
// author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com | |
#![feature(generator_trait)] | |
use std::ops::{Generator, GeneratorState}; | |
use std::pin::Pin; | |
use num_integer::Integer; |