Skip to content

Instantly share code, notes, and snippets.

View jerrylususu's full-sized avatar

Neko Null jerrylususu

View GitHub Profile
@jerrylususu
jerrylususu / perform-transform.js
Last active March 1, 2023 15:22
TS logging idea
const ts = require("typescript");
const {readFileSync} = require("fs");
const filename = "source.ts";
// tsconfig
const options = {"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node"}
const compilerHost = {
...ts.createCompilerHost(options),
@jerrylususu
jerrylususu / BENCHMARK.txt
Created February 25, 2023 15:06
Node.js Winston logging with source lines example
## method
disable line no / file name logging: comment out line 10~13 in `index.js`
benchmark use `gocannon`: ./gocannon http://localhost:3000 -d 10s -c 50
## summary
without: 3495 req/s
with: 3204 req/s
perf cost: ~8.3%
## without line no / file name logging
@jerrylususu
jerrylususu / Metro_Cycles_README.txt
Last active December 25, 2022 07:18
metro cycles
原帖:https://bgm.tv/group/topic/375970
TLDR:本 gist 试图找出深圳地铁图上的最长环
新算法运行说明
1. 把 `metroStationsList.js` 里的站点信息单独存储成一个 `all_lines.json`
2. 运行 `prepare_graph.py`
3. 运行 `find_graphillion.py`
4. 运行 `decode_result.py`
@jerrylususu
jerrylususu / PyItertoolPermutation.java
Created May 8, 2022 18:13
Reimplement of Python's itertools.permutations in Java
public class PyItertoolPermutation {
public static void main(String[] args) {
char[] arr = {'A', 'B', 'C', 'D'};
int r = 2;
dfs(0, arr, r);
}
public static void dfs(int changing_idx, char[] arr, int r) {
if (changing_idx == r){
@jerrylususu
jerrylususu / cut.py
Created March 21, 2022 15:15
Key-frame based FFmpeg Cut
# WARNING: NOT QUITE WORKING...
import sys
import subprocess
import bisect
from pathlib import Path
def run_command(command_list):
success = True
@jerrylususu
jerrylususu / bgm.ipynb
Last active January 19, 2022 20:36
Bangumi x IMDB
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jerrylususu
jerrylususu / generate_pdf_with_toc.py
Last active December 21, 2021 14:40
《凤凰架构》PDF 增加目录
import json
import toml
from pdftocgen.recipe import extract_toc, Recipe
from fitzutils import ToCEntry, dump_toc, open_pdf
from pdftocio.tocio import write_toc
# requiremnets
# ----------------------------
# ruquire `pdf.tocgen`
# https://github.com/Krasjet/pdf.tocgen
@jerrylususu
jerrylususu / demo.html
Created December 18, 2021 16:53
Simple Dark Mode with CSS Filter `invert`
<!DOCTYPE html>
<html lang="cmn-Hans">
<head>
<meta charset="utf-8">
<title>Hello!</title>
<style id="dark-mode-theme" disabled>
html {
background-color: #ebebeb !important;
}
@jerrylususu
jerrylususu / emoji-ranges.txt
Created September 30, 2021 23:12
Regex & CSS unicode-range for Emoji (2021, Unicode Version 14.0)
# Note
# some codepoints you might want to remove:
# u+00a9: copyright
# u+00ae: registered
# Regex
(\u00a9|\u00ae|\u203c|\u2049|\u20e3|\u2122|\u2139|[\u2194-\u2199]|[\u21a9-\u21aa]|[\u231a-\u231b]|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\u24c2|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|[\u2600-\u2604]|\u260e|\u2611|[\u2614-\u2615]|\u2618|\u261d|\u2620|[\u2622-\u2623]|\u2626|\u262a|[\u262e-\u262f]|[\u2638-\u263a]|\u2640|\u2642|[\u2648-\u2653]|[\u265f-\u2660]|\u2663|[\u2665-\u2666]|\u2668|\u267b|[\u267e-\u267f]|[\u2692-\u2697]|\u2699|[\u269b-\u269c]|[\u26a0-\u26a1]|\u26a7|[\u26aa-\u26ab]|[\u26b0-\u26b1]|[\u26bd-\u26be]|[\u26c4-\u26c5]|\u26c8|[\u26ce-\u26cf]|\u26d1|[\u26d3-\u26d4]|[\u26e9-\u26ea]|[\u26f0-\u26f5]|[\u26f7-\u26fa]|\u26fd|\u2702|\u2705|[\u2708-\u270d]|\u270f|\u2712|\u2714|\u2716|\u271d|\u2721|\u2728|[\u2733-\u2734]|\u2744|\u2747|\u274c|\u274e|[\u2753-\u2755]|\u2757|[\u2763-\u2764]|[\u2795-\u2797]|\u27a1|\u27b0|\u27bf|[\u2934-\u2935]|[\u2b05-\u2b07]|[\u2b1b-\u2b1c]|\u2b50|\u2b55|\u3030|\u
@jerrylususu
jerrylususu / run.sh
Last active July 3, 2021 14:05
Install tensorflow-gpu 2.5.0 with conda (2021/7/3)
# as of writing (2021/7/3), here is a list of the version of latest packages (arch=linux64):
# tensorflow-gpu: 2.4.0 (anaconda)
# cudnn: 8.2.1 (conda-forge)
# cudatoolkit: 11.0.221 (anaconda)
# step 1: create new conda environment, install python & cudatoolkit
conda create -n tf_25_new python=3.8 cudatoolkit=11.0.221
conda activate tf_25_new
# step 2: install cudann from conda forge