Skip to content

Instantly share code, notes, and snippets.

@Hexcles
Hexcles / reopen-wpt-prs.py
Created January 24, 2020 19:56
WPT PR Recovery
#!/usr/bin/env python3
import json
import requests
with open("github-credentials.json", "r") as f:
creds = json.load(f)
prs = open("pr-list", "r")
with open("pr-errors", "w") as err:
@Hexcles
Hexcles / .ycm_extra_conf.py
Created May 7, 2015 22:15
YouCompleteMe extra conf for Linux kernel
# .ycm_extra_conf.py for kernel
import os
# Attention:
# File path not starting with / or = will be expanded.
flags_c = [
'-Wall',
'-Wundef',
'-Wstrict-prototypes',
@Hexcles
Hexcles / stylish-font-replacement.css
Last active January 2, 2022 03:35
Font substitute CSS for web pages
/*
* Replace ugly Chinese bitmap fonts with system default sans-serif.
* ATTENTION: this will intentionally change the appearance of web pages!
* Most Chinese websites do not mean to use serif fonts, especially for these ugly ones.
*/
@font-face {
font-family: "宋体";
src: local("sans-serif");
}
@Hexcles
Hexcles / vpn.sh
Last active October 9, 2021 05:06
ZJU VPN dial up script (xl2tpd + systemd, for Archlinux)
#!/bin/bash
PPP_TIMEOUT=15
L2TPD_TIMEOUT=5
L2TPD_CONTROL_FILE=/var/run/xl2tpd/l2tp-control
VPN_ACCOUNT=zjuvpn-a
function start_xl2tpd
{
systemctl start xl2tpd
@Hexcles
Hexcles / bootstrap.sh
Last active April 30, 2020 21:23
Test dl.google.com
# On the host VM (run as root):
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get install -qy docker-ce
systemctl daemon-reload && systemctl start docker.service
docker run -it ubuntu:latest bash
@Hexcles
Hexcles / CDP_Command_for_WPT.md
Created September 19, 2019 04:44
Puppeteer/CDP for WPT

Based on @jugglinmike ExecutorCDP prototype

grep 'API status' tools/pyppeteer/ -r | grep -Eo "'[A-Z][A-Za-z]+\.[A-Za-z]+'" | sort | uniq -c | sort -rn
5 'Input.dispatchMouseEvent'
4 'Runtime.releaseObject'
4 'Input.dispatchKeyEvent'
@Hexcles
Hexcles / sunpinyin_speedup.sh
Last active December 12, 2018 05:41
Sunpinyin Speedup
#!/bin/bash
#sunpinyin_speedup.sh
# Sunpinyin Speedup Script (by memory caching using shm, and no data loss)
# You can run this script in background on GNOME logging in.
# Hexcles Ma(http://robotshell.org/), Published in Public Domain
# Capture the exit signal, make sure it is the FIRST uncommented line.
trap "do_exit" SIGHUP SIGINT SIGQUIT SIGTERM
# Backup checking interval(seconds)
@Hexcles
Hexcles / zjuwlan.sh
Created May 19, 2014 02:38
ZJUWLAN login script (curl, force HTTPS)
#!/bin/bash
# Abort when curl fails
set -e
USERNAME=
PASSWORD=
echo -n "Force logging off: "
curl 'https://net.zju.edu.cn/rad_online.php' -H 'Origin: https://net.zju.edu.cn' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: */*' -H 'Referer: https://net.zju.edu.cn/srun_port1.php?url=http://www.example.com/' --data "action=auto_dm&username=${USERNAME}&password=${PASSWORD}" >/dev/null 2>&1
echo "success!"
@Hexcles
Hexcles / find_dupes.py
Last active November 14, 2017 21:18
Simple LayoutTests global baseline optimization
from __future__ import print_function
from collections import defaultdict
import hashlib
import re
def main():
baselines = defaultdict(dict)
f = open('baselines', 'r')
regexp_head = re.compile(r'^\./(platform/[^/]+/)')
@Hexcles
Hexcles / wpt-export-stats.py
Last active September 25, 2017 23:22
WPT Export Stats
#!/usr/bin/python2
# Based off https://gist.github.com/jeffcarp/f1fb015e38f50e82d30b8c69b67faa74
# Requirements: numpy & requests ( sudo apt install python-{numpy,requests} )
from __future__ import print_function
from datetime import datetime
import csv
import collections
import json
import numpy