Skip to content

Instantly share code, notes, and snippets.

@scottt
scottt / GNUmakefile
Last active April 5, 2023 19:22
Memory stores cause minor page faults after fork() but not after vfork() on Linux
CFLAGS := -Wall -Og
PROGRAMS := fork-exec-memset vfork-exec-memset
.PHONY: all
all: $(PROGRAMS)
.PHONY: test
test: all
./test-fork-exec-memset
@scottt
scottt / div0.c
Last active February 26, 2023 13:05
Generate SIGFPE through integer division by zero
volatile int a, b, out;
__attribute__((noclone,noinline))
void g(void)
{
a = -1;
b = 0;
out = a/b;
}
@scottt
scottt / burn-cpu-and-segfault.c
Last active July 10, 2022 08:33
signalfd SIGCHLD handling
/* Burn some CPU time then segfault */
int main()
{
volatile int i;
for (i=0; i>=0; i++)
;
*(volatile char*)0;
return 0;
}
# openssl speed -elapsed -evp aes-128-gcm
You have chosen to measure elapsed time instead of user CPU time.
Doing aes-128-gcm for 3s on 16 size blocks: 55740342 aes-128-gcm's in 3.00s
Doing aes-128-gcm for 3s on 64 size blocks: 36792402 aes-128-gcm's in 3.00s
Doing aes-128-gcm for 3s on 256 size blocks: 19513330 aes-128-gcm's in 3.00s
Doing aes-128-gcm for 3s on 1024 size blocks: 6431553 aes-128-gcm's in 3.00s
Doing aes-128-gcm for 3s on 8192 size blocks: 943229 aes-128-gcm's in 3.00s
Doing aes-128-gcm for 3s on 16384 size blocks: 478375 aes-128-gcm's in 3.00s
OpenSSL 1.1.1c 28 May 2019
built on: Wed May 29 17:53:30 2019 UTC
@scottt
scottt / bin-true-ld.so-processing-log
Last active April 6, 2021 06:17
Observe mmap operations performed by the dynamic linker by running "gdb -x observe-maps-on-mmap.py"
== malloc()
_dl_init_paths()
Catchpoint 1 (syscalls 'mmap' [9] 'mprotect' [10] 'munmap' [11])
Breakpoint 2 at 0x1650: file src/true.c, line 59.
Catchpoint 1 (call to syscall mmap), 0x00007ffff7df54da in mmap64 () at ../sysdeps/unix/syscall-template.S:84
84 T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
Catchpoint 1 (returned from syscall mmap), 0x00007ffff7df54da in mmap64 () at ../sysdeps/unix/syscall-template.S:84
@scottt
scottt / Matplotlib-Set-Font-for-zh-TW.ipynb
Created October 26, 2017 05:18
Matplotlib set suitable font for zh_TW text
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BRN30055CC52E61.local
Thunder 测试网资讯
1. RPC 网址
https://testnet-rpc.thundercore.com
wss://testnet-ws.thundercore.com
2. 区块浏览器
https://scan-testnet.thundercore.com
3. 发钱水龙头 Faucet
https://drill-migration.s3-ap-northeast-1.amazonaws.com/drill-migration.tar.gz
https://thundercore-chain-data-us-east-1.s3.amazonaws.com/latest