Skip to content

Instantly share code, notes, and snippets.

@upsuper
upsuper / Cargo.toml
Last active Jul 11, 2019
Verify whether there is any MD5 conflict in all possible Chinese mobile numbers https://twitter.com/upsuper/status/1148222832540672001
View Cargo.toml
[package]
name = "cnmobile-md5"
version = "0.1.0"
authors = ["Xidorn Quan <me@upsuper.org>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[profile.release]
lto = true
@upsuper
upsuper / split-servo.py
Created Aug 3, 2018
A filter script of `hg transplant` for coordinated landing for Stylo development
View split-servo.py
#!/usr/bin/env python
# - * - coding: UTF-8 - * -
import sys
from subprocess import Popen, PIPE
SERVO_PATH = r'c:\\mozilla-source\\servo'
msg = sys.argv[1]
View keybase.md

Keybase proof

I hereby claim:

  • I am upsuper on github.
  • I am upsuper (https://keybase.io/upsuper) on keybase.
  • I have a public key ASBKx3KVHC8RM6BT-FdgQRvI3tcyORQ-ctJl8Kwhe9VMdAo

To claim this, I am signing this object:

@upsuper
upsuper / bind-backup.sh
Last active Nov 11, 2019
Script to automatically bind and unbind external USB drive on Synology NAS
View bind-backup.sh
#!/bin/bash
SERIAL="00000000"
echo "Looking for device with serial $SERIAL..."
for d in /sys/bus/usb/devices/*-*; do
if [[ -f "$d/serial" ]]; then
serial=$(<"$d/serial")
if [[ "$serial" = "$SERIAL" ]]; then
device="$(basename $d)"
@upsuper
upsuper / RevokeWoSign_FirefoxOSX.sh
Last active Sep 28, 2019
Script to revoke WoSign-related certificates on Firefox for OS X
View RevokeWoSign_FirefoxOSX.sh
#!/bin/bash
CERTUTIL="/usr/local/opt/nss/bin/certutil"
if [ ! -f "$CERTUTIL" ]; then
echo "certutil is not found." >&2
echo "You can install it via 'brew install nss'." >&2
exit 1
fi
RCC_DIR=RevokeChinaCerts
View gist:bce38e7d40b9d4414712
#include <iostream>
#include <stddef.h>
namespace mozilla {
template<typename Iterator>
struct IteratorTraits
{
typedef typename Iterator::ValueType ValueType;
@upsuper
upsuper / myext.py
Last active Jan 14, 2016
Mercurial extension for my local Mozilla repo
View myext.py
# - * - coding: UTF-8 - * -
import re
import os
import os.path
import marshal
from mercurial import cmdutil, patch, revset
from mercurial.error import ParseError
from mercurial.node import bin, hex
View gist:ac982f1eff9bdfeef536
r=lambda s:s.replace("\\","\\\\").replace("\"","\\\"");a,b="r=lambda s:s.replace(\"\\\\\",\"\\\\\\\\\").replace(\"\\\"\",\"\\\\\\\"\");a,b=\"","\";print(a+r(a)+\"\\\",\\\"\"+r(b)+b)";print(a+r(a)+"\",\""+r(b)+b)
@upsuper
upsuper / tone-mark-positioning.html
Last active Aug 29, 2015
Tone mark positioning polyfill
View tone-mark-positioning.html
<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta charset="UTF-8">
<title>Polyfill demo for tone mark positioning</title>
<style>
body {
-webkit-writing-mode: vertical-rl;
-ms-writing-mode: tb-rl;
writing-mode: vertical-rl;
@upsuper
upsuper / maketiles.py
Created Dec 25, 2014
Customize Firefox Tiles
View maketiles.py
#!/usr/bin/env python3
import sys as _sys
import json as _json
import base64 as _base64
import logging as _logging
import mimetypes as _mimetypes
import urllib.parse as _url
import configparser as _configparser
You can’t perform that action at this time.