Skip to content

Instantly share code, notes, and snippets.

View jerrylususu's full-sized avatar

Neko Null jerrylususu

View GitHub Profile
@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 / 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 / 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 / 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),
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Parse Protobuf File in Frontend Example</title>
</head>
<body>
<textarea id="protobuf-content" rows="10" cols="80"></textarea>
@jerrylususu
jerrylususu / checker.py
Created April 16, 2023 08:24
progress bar checker
# built with chatgpt
import pyautogui
import cv2 # opencv-python
import numpy as np
import time
from datetime import datetime, timedelta
# also need: pillow
@jerrylususu
jerrylususu / demo.html
Created April 27, 2023 15:00
protobuf string to base64
<!DOCTYPE html>
<html>
<head>
<title>Base64 Encoder</title>
</head>
<body>
<textarea id="myTextArea" rows="10" cols="50"></textarea>
<br>
<button onclick="encodeText()">Encode to Base64</button>
<br>
@jerrylususu
jerrylususu / gpt-stream.py
Created June 14, 2023 15:40
simple gpt streaming implementation (works as 2023/6/14)
import requests
import json
import sseclient
# API_KEY = 'sk-xxx'
def performRequestWithStreaming():
reqUrl = 'https://api.openai.com/v1/chat/completions'
reqHeaders = {
@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 / fib.js
Created July 29, 2023 13:22
es module worker
export function fibonacci(num) {
if (num <= 1) return num;
return fibonacci(num - 1) + fibonacci(num - 2);
}