Skip to content

Instantly share code, notes, and snippets.

View Timothy-Liuxf's full-sized avatar
🎯
Focusing

Timothy Liu Timothy-Liuxf

🎯
Focusing
View GitHub Profile
@Timothy-Liuxf
Timothy-Liuxf / cppquiz_downloader.py
Last active July 14, 2023 16:08
C++ Quiz Downloader
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
MIT License
Copyright (c) 2023 Timothy Liu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@Timothy-Liuxf
Timothy-Liuxf / install.sh
Last active May 28, 2024 07:44
Install gRPC for Python and C++ on Linux
#!/bin/bash
# Install gRPC SDK for C++ or Python3 v1.0.1
# MIT License
# Copyright (c) 2022 Timothy Liu
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@Timothy-Liuxf
Timothy-Liuxf / ConvertToChinese.cs
Last active May 3, 2022 20:30 — forked from x5lcfd/ConvertToChinese.cs
MoneyInArabicNumeralsToChinese
public static string ConvertToChinese(decimal number)
{
var s = number.ToString("#L#E#D#C#K#E#D#C#J#E#D#C#I#E#D#C#H#E#D#C#G#E#D#C#F#E#D#C#.0B0A");
var d = Regex.Replace(s, @"((?<=-|^)[^1-9]*)|((?'z'0)[0A-E]*((?=[1-9])|(?'-z'(?=[F-L\.]|$))))|((?'b'[F-L])(?'z'0)[0A-L]*((?=[1-9])|(?'-z'(?=[\.]|$))))", "${b}${z}");
var r = Regex.Replace(d, ".", m => "负元空零壹贰叁肆伍陆柒捌玖空空空空空空空分角拾佰仟万亿兆京垓秭穰"[m.Value[0] - '-'].ToString());
return r;
}
@Timothy-Liuxf
Timothy-Liuxf / extract.py
Last active April 21, 2022 09:07
Extract codes in the form of raw string of json and write to source code file.
################################################################################
# Suppose we have a json file `jcodes.json` as shown which contains some C++
# code as string. This python program can generate C++ source files containing
# the code.
################################################################################
import json
import os
with open("jcodes.json", "r", encoding="utf-8") as code: