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 | |
# date: 2024-05-21 | |
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt | |
# author: nanpuyue <[email protected]> https://blog.nanpuyue.com | |
# 设置接口名称和流量限制 | |
IFACE="eth0" | |
LIMIT="190 GiB" | |
# vnstat 数据库文件路径 |
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: 2023-06-12 | |
// license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt | |
// author: nanpuyue <[email protected]> https://blog.nanpuyue.com | |
// build: gcc -fPIC -shared -o hook_uname.so hook_uname.c -ldl | |
// usage: LD_PRELOAD=./hook_uname.so uname -a | |
#include <string.h> | |
#include <dlfcn.h> | |
#include <sys/utsname.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
#!/bin/bash | |
docker() { | |
case "$1" in | |
htop) | |
local container="$2" | |
if [ -z "$container" ]; then | |
echo -e '"docker htop" requires at least 1 argument.\n' | |
echo -e 'Usage:\n\tdocker htop CONTAINER [htop OPTIONS]' | |
return 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: 2022-05-09 | |
// license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt | |
// author: nanpuyue <[email protected]> https://blog.nanpuyue.com | |
use std::mem::take; | |
fn push(buf: &mut &mut [u8], value: u8) { | |
buf[0] = value; | |
*buf = &mut take(buf)[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
/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 <[email protected]> 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
// date: 2020-07-06 | |
// license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt | |
// author: nanpuyue <[email protected]> https://blog.nanpuyue.com | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <arpa/inet.h> | |
#include <fcntl.h> | |
#include <sys/epoll.h> |
NewerOlder