Skip to content

Instantly share code, notes, and snippets.

View johnjohnlin's full-sized avatar

Yu-Sheng Lin johnjohnlin

  • Taiwan
View GitHub Profile
@johnjohnlin
johnjohnlin / preprocessor_inc.c
Created May 12, 2025 17:19
POC: How to implement large integer addition using only macro
#define _ADD_TABLE00 0,0
#define _ADD_TABLE01 0,1
#define _ADD_TABLE02 0,2
#define _ADD_TABLE03 0,3
#define _ADD_TABLE04 0,4
#define _ADD_TABLE05 0,5
#define _ADD_TABLE06 0,6
#define _ADD_TABLE07 0,7
#define _ADD_TABLE08 0,8
#define _ADD_TABLE09 0,9
@johnjohnlin
johnjohnlin / .gitconfig
Created October 4, 2022 16:33
My configuration backup
[user]
name = Yu-Sheng Lin
email = johnjohnlys@gmail.com
[core]
editor = nvim
pager =
[push]
default = current
[color]
ui = auto
@johnjohnlin
johnjohnlin / odg2svgs.py
Created September 22, 2020 16:28
A simple script converting an odg file into individual SVG pages, works for libreoffice 7.0
#!python
# usage: if you have an xxx.odg, then execute `./odg2svgs.py xxx`
import sys
import subprocess
import xml.etree.ElementTree as ET
kBASENAME = sys.argv[1]
subprocess.run(["libreoffice", "--draw", "--headless", "--convert-to", "svg", kBASENAME+".odg"], check=True)
tree = ET.parse(kBASENAME + ".svg")
@johnjohnlin
johnjohnlin / leetcode_tree.cpp
Created June 18, 2019 10:00
A snippet that can help you make TreeNode structure from Leetcode tree text like [1,2,-3,-5,null,4,null].
#include <algorithm>
#include <utility>
#include <stack>
#include <vector>
using namespace std;
#define null nullptr
struct TreeNode {
int val;
TreeNode *left;