Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
͜͡w͜͜͡͡o͜͜͡͡w͜͜͡͡,͜͜͡͡ ͜͜͡͡G͜͜͡͡i͜͜͡͡t͜͜͡͡H͜͜͡͡u͜͜͡͡b͜͡!

CUI Hao cuihaoleo

:octocat:
͜͡w͜͜͡͡o͜͜͡͡w͜͜͡͡,͜͜͡͡ ͜͜͡͡G͜͜͡͡i͜͜͡͡t͜͜͡͡H͜͜͡͡u͜͜͡͡b͜͡!
View GitHub Profile
View cgroup.conf
CgroupAutomount=no
CgroupMountpoint=/sys/fs/cgroup
ConstrainCores=yes
ConstrainDevices=yes
ConstrainRAMSpace=no
ConstrainSwapSpace=yes
AllowedSwapSpace=20
TaskAffinity=no
@cuihaoleo
cuihaoleo / benchmark.sh
Created Jun 10, 2022
Float square vs abs vs sqrt
View benchmark.sh
#!/bin/bash
set -e
for opt in -O0 -O1 -O2 -O3; do
echo "GCC PARAM: $opt"
gcc -c -o libtest.o libtest.c "$opt"
gcc -o main.exe main.c libtest.o -lm
./main.exe
echo ""
View ConnectBssid.cpp
#pragma comment(lib, "Wlanapi.lib")
#include <iostream>
#include <string>
#include <chrono>
#include <thread>
#include <regex>
#include <vector>
#include <utility>
#include <codecvt>
View server-backup.service
[Unit]
Description=Backup data using restic
After=network-online.target
Wants=network-online.target
[Service]
User=root
Group=root
EnvironmentFile=/etc/systemd/%N.env
@cuihaoleo
cuihaoleo / resolver.py
Created Oct 1, 2021
IPv4-First Resolver
View resolver.py
#!/usr/bin/env python3
import argparse
import socket
import time
from dnslib import DNSRecord, QTYPE, RCODE
from dnslib.server import BaseResolver, DNSLogger, DNSServer
@cuihaoleo
cuihaoleo / depgraph.gml
Created Apr 25, 2021
PoliCheck GraphMatcher bug reproduce
View depgraph.gml
graph [
directed 1
node [
id 0
label "(3, collect, <AnnotationType.COLLECT_VERB: 3>)"
tag "<AnnotationType.COLLECT_VERB: 3>"
lemma "'store,collect'"
lemmaList "'store'"
lemmaList "'collect'"
dep "'conj'"
@cuihaoleo
cuihaoleo / cdm-fio.py
Created Jun 8, 2020
Something like CrystalDiskMark
View cdm-fio.py
#!/usr/bin/env python3
import json
import subprocess
import tempfile
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-n", "--loops", type=int, default=5,
help="Number of runs for each test.")
@cuihaoleo
cuihaoleo / chito.py
Created Feb 23, 2019
Export is-programmer.com data to JSON
View chito.py
#!/usr/bin/env python3
import os
import datetime
import logging
import psycopg2
from requestsutils import RequestsBase
from htmlutils import parse_document_from_requests
View smart_pxe.yaml
define:
- MIRRORS_HOST: mirrors.ustc.edu.cn
- PXE_HOST: pxe.ustc.edu.cn
- TFTP_EXPORT: /srv/tftp/data
- HTTP_EXPORT: /srv/http/data
- DOWNLOAD_POOL: download/
menu:
- name: Arch Linux
menu:
- name: Arch Linux (${version})
View test14.txt
execve("/home/cuihao/temp/a.out", ["/home/cuihao/temp/a.out"], [/* 18 vars */]) = 0
brk(NULL) = 0x7fffc7a79000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2bd2fc0000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=52542, ...}) = 0
mmap(NULL, 52542, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2bd2fb3000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)