Skip to content

Instantly share code, notes, and snippets.

View kLiHz's full-sized avatar

kLiHz kLiHz

View GitHub Profile
@kLiHz
kLiHz / .gitignore
Last active May 2, 2022 17:36
Time Consumption of Abusing Python List Deduction
__pycache__/
@kLiHz
kLiHz / README.md
Last active November 1, 2021 11:59
Terminal Output to SVG

Terminal Output (in HTML <p>s) to SVG

The reason I built this was that I was unable to find a tool to convert Windows Terminal's output to SVG (not a animated SVG, just a screenshot).

Since one can copy Windows Terminal's output as HTML code, I tried to find some tools to convert HTML to SVG. But I can't find any either.

By the way, Asciinema can record CLI output in its own format, and it can save its recordings as 'raw' format, in which I guess are some escape sequences. Maybe one can choose to convert those sequence to SVG.

Update: I found something that might be seful:

@kLiHz
kLiHz / README.md
Last active August 11, 2021 20:01
A C++ Sudoku Solver
@kLiHz
kLiHz / MIPS32-instruction-formats.md
Last active July 22, 2021 02:00
MIPS32 Instruction Formats
funct
R opcode rs rt rd shamt
@kLiHz
kLiHz / Client.java
Last active July 17, 2021 20:32
Java Socket Sever Client Object Transfer
package com.henry.net;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.util.Arrays;
public class Client {
private Socket socket;
@kLiHz
kLiHz / year_of_the_cow.cpp
Created May 23, 2021 08:56
USACO21 FEB BRONZE
#include <iostream>
#include <map>
#include <string>
// Assume Cow B in each line appeared before
class Solution {
public:
enum class Relation {BEFORE, AFTER};
enum class Zodiac {
@kLiHz
kLiHz / passage.txt
Last active May 12, 2021 15:40
Find word in a file.
Next to a great forest there lived a poor woodcutter with his wife and his two children.
The boy's name was Hansel and the girl's name was Gretel. He had but little to eat, and
once, when a great famine came to the land, he could no longer provide even their daily
bread.
One evening as he was lying in bed worrying about his problems, he sighed and said to his
wife, "What is to become of us? How can we feed our children when we have nothing for
ourselves?"
"Man, do you know what?" answered the woman. "Early tomorrow morning we will take the two
@kLiHz
kLiHz / print_I64.cpp
Last active December 24, 2020 19:08
Convert signed 64-bit int
#include <iostream>
#include <chrono>
void print_I64(long long num) {
// Try NOT using `if` statement, since it will make the program slower
char str[32] = {0};
short idx = 31;
long long sign = num >> 63; // -1 for negative, 0 for positive
// by doing this we assume that the spaces are filled with num's sign bit
num ^= sign;