Instantly share code, notes, and snippets.
- Sydney, Australia
- 03:31
(UTC +10:00) - https://www.upsuper.org/
- @upsuper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
importplistlib | |
importsqlite3 | |
importuuid | |
fromcollectionsimportdefaultdict | |
fromdatetimeimportdatetime | |
fromtypingimportNamedTuple | |
fromurllib.parseimportunquote |
upsuper /delayed_balance.py
CreatedJune 27, 2021 10:29
Beancount plugin to handle transactions geting delayed and not being included in the next bank statement This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Copyright (C) 2021 Xidorn Quan | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU Affero General Public License as | |
# published by the Free Software Foundation, either version 3 of the | |
# License, or (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, |
upsuper /commodity_par.py
CreatedMarch 27, 2021 05:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Copyright (C) 2021 Xidorn Quan | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU Affero General Public License as | |
# published by the Free Software Foundation, either version 3 of the | |
# License, or (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, |
upsuper /transform.yaml
Last activeOctober 5, 2020 02:46
An example transformation file for translated Simplified Chinese result of 2020 State of Rust survey. Seehttps://github.com/upsuper/csv-transformer This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
--- | |
-transform:timestamp | |
column:"C: End time" | |
header:"Timestamp" | |
from:"%d-%b-%Y %H:%M:%S" | |
to:"%d/%m/%Y %H:%M:%S" | |
-"E: Do you use Rust?" | |
-"F: How long did you use Rust before you stopped?" | |
-"G: How long ago did you stop using Rust?" | |
-transform:join |
upsuper /Cargo.toml
Last activeJuly 11, 2019 10:16
Verify whether there is any MD5 conflict in all possible Chinese mobile numbershttps://twitter.com/upsuper/status/1148222832540672001 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[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 /split-servo.py
CreatedAugust 3, 2018 04:23
A filter script of `hg transplant` for coordinated landing for Stylo development This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# - * - coding: UTF-8 - * - | |
importsys | |
fromsubprocessimportPopen,PIPE | |
SERVO_PATH=r'c:\\mozilla-source\\servo' | |
msg=sys.argv[1] |
upsuper /keybase.md
CreatedOctober 26, 2017 00:09
upsuper /bind-backup.sh
Last activeDecember 17, 2024 01:50
Script to automatically bind and unbind external USB drive on Synology NAS This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
#!/bin/bash | |
SERIAL="00000000" | |
echo"Looking for device with serial$SERIAL..." | |
fordin /sys/bus/usb/devices/*-*;do | |
if [[-f"$d/serial" ]];then | |
serial=$(<"$d/serial") | |
if [["$serial"="$SERIAL" ]];then | |
device="$(basename$d)" |
upsuper /RevokeWoSign_FirefoxOSX.sh
Last activeSeptember 28, 2019 08:11
Script to revoke WoSign-related certificates on Firefox for OS X This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
#!/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 |
upsuper /gist:bce38e7d40b9d4414712
Last activeAugust 29, 2015 14:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<stddef.h> | |
namespacemozilla { | |
template<typename Iterator> | |
structIteratorTraits | |
{ | |
typedeftypename Iterator::ValueType ValueType; |
NewerOlder