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
#pragma once | |
#ifndef DEFER_HPP_DEFINED | |
#define DEFER_HPP_DEFINED | |
/* | |
defer.hpp v20190325 | |
Simple Scope-guard(defer) implementation under C++17. | |
Released under MIT License. | |
Support: C++17 |
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
#pragma once | |
#ifndef PRINT_TYPE_NAME_HPP_DEFINED | |
#define PRINT_TYPE_NAME_HPP_DEFINED | |
/* | |
Usage: | |
void print_type_name<T>() {...} | |
Print type name of T, exactly the same as declaration. |
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
#pragma once | |
#ifndef HEAP_VAR_HPP | |
#define HEAP_VAR_HPP | |
/* | |
Introduction: | |
In order not to cause a stack overflow, sometimes you must define | |
large objects on the heap. But heap variables are somewhat hard to use. |
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
/* | |
Simple warning light flashing in your terminal. | |
Compile with the following arguments: | |
<YOUR COMPILER> --std=c++17 -O2 -lcurses -o warn-light warn-light.cc | |
*/ | |
#include <ncurses.h> | |
#include <stdint.h> | |
#include <unistd.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
import java.lang.reflect.Field; | |
import java.lang.reflect.Method; | |
import java.lang.reflect.Modifier; | |
import java.util.*; | |
import java.util.stream.Collectors; | |
/** | |
* Usage: | |
* <code> | |
* System.out.print(printInfo(java.time.format.DateTimeFormatter.class)); |
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
# Python 自打印程序示例 | |
# 直接运行本程序,控制台就会输出这个程序本身的代码! | |
打印内容 = '''# Python 自打印程序示例 | |
# 直接运行本程序,控制台就会输出这个程序本身的代码! | |
print_content = {引号}{引号}{引号}{替换内容}{引号}{引号}{引号} | |
print(打印内容.format(引号="'", 替换内容=打印内容))''' |
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
import numpy as np | |
from PIL import Image | |
__all__ = ( | |
'image_to_numpy', | |
'numpy_to_image', | |
) | |
IMAGE_MEAN = np.array([0.485, 0.456, 0.406], dtype=np.float32).reshape((3, 1, 1)) | |
IMAGE_STD = np.array([0.229, 0.224, 0.225], dtype=np.float32).reshape((3, 1, 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
// ==UserScript== | |
// @name B站视频显示点赞率 | |
// @namespace https://ipid.me | |
// @version 0.1 | |
// @description 在视频播放页面显示点赞率(点赞数 / 总播放数) | |
// @author ipid | |
// @match *://www.bilibili.com/video/* | |
// ==/UserScript== | |
(function () { |
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
// ==UserScript== | |
// @name dblp 按条件隐藏论文 | |
// @namespace https://ipidkun.com | |
// @version 0.1 | |
// @description 隐藏只命中作者的论文,隐藏非 CCF A、CCF B 的论文 | |
// @author ipid | |
// @match *://dblp.org/* | |
// @match *://*.dblp.org/* | |
// @match *://dblp.uni-trier.de/* | |
// @match *://*.dblp.uni-trier.de/* |
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
[Interface] | |
Address = 10.0.0.1/24 | |
PrivateKey = ****************************************** | |
ListenPort = 51000 | |
DNS = 223.5.5.5 | |
PostUp = iptables -t nat -F; iptables -t nat -A PREROUTING -p tcp -m multiport --dports 1024:50999,51001:65534 -i eth0 -j DNAT --to-destination 10.0.0.2; iptables -t nat -A PREROUTING -p udp -m multiport --dports 1024:50999,51001:65534 -i eth0 -j DNAT --to-destination 10.0.0.2; iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o eth0 -j MASQUERADE | |
PostDown = iptables -t nat -F | |
[Peer] | |
AllowedIPs = 10.0.0.2/32 |
OlderNewer