Skip to content

Instantly share code, notes, and snippets.

🇨🇳
͜͡w͜͜͡͡o͜͜͡͡w͜͜͡͡,͜͜͡͡ ͜͜͡͡G͜͜͡͡i͜͜͡͡t͜͜͡͡H͜͜͡͡u͜͜͡͡b͜͡!

CUI Hao cuihaoleo

View GitHub Profile
@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 cgroup.conf
CgroupAutomount=no
CgroupMountpoint=/sys/fs/cgroup
ConstrainCores=yes
ConstrainDevices=yes
ConstrainRAMSpace=no
ConstrainSwapSpace=yes
AllowedSwapSpace=20
TaskAffinity=no
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)
View strace.txt
execve("/usr/bin/git", ["git", "config", "test.test", "test"], [/* 18 vars */]) = 0
brk(NULL) = 0x7fffb909c000
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) = 0x7f5e08070000
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) = 0x7f5e08063000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
View update-he-ddns.sh
#!/bin/bash
DOMAIN=$1
KEY=$2
IPV4=$(ip route get 1 | grep -Po '(?<=src )[^ ]+')
IPV6=$(ip route get 2001:: | grep -Po '(?<=src )[^ ]+')
if [[ -n $IPv4 ]]; then
echo "Update IPv4: $IPV4"
View keybase.md

Keybase proof

I hereby claim:

  • I am cuihaoleo on github.
  • I am cuihao (https://keybase.io/cuihao) on keybase.
  • I have a public key whose fingerprint is AA0C BF38 59E5 80B9 7D9F 0463 8FDE 3D8F C99F 40AE

To claim this, I am signing this object:

View crypto.py
#!/usr/bin/env python3
import binascii
import string
from collections import Counter
total_chars = 0
lines = []
result = []
@cuihaoleo
cuihaoleo / Hello.g4
Created Jan 26, 2016 — forked from mattmcd/Hello.g4
Simple ANTLR4 grammar example
View Hello.g4
// define a grammar called Hello
grammar Hello;
r : 'hello' ID;
ID : [a-z]+ ;
WS : [ \t\r\n]+ -> skip ;
View gist:a311de2dcbffa401fe3a
import concurrent.futures
with concurrent.futures.ProcessPoolExecutor() as executor:
for ans in executor.map(lambda x: 2**x, range(10)):
print(ans)
You can’t perform that action at this time.