Skip to content

Instantly share code, notes, and snippets.

View CSUwangj's full-sized avatar
🚩
Focusing

望将 CSUwangj

🚩
Focusing
View GitHub Profile
@CSUwangj
CSUwangj / generate_metadata.py
Created October 9, 2022 03:13
generate_metadata.py
meta = {
"formatVersion": 1,
"appVersion": "0.54.2",
"files": []
}
year_meta = {
"isClone": False,
"title": "2022",
"notePosition": 10,
"isExpanded": False,
@CSUwangj
CSUwangj / get-vscode-server.sh
Last active November 9, 2020 10:46
get vscode server
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Download url is: https://update.code.visualstudio.com/commit:${commit_id}/server-linux-x64/stable
curl -sSL "https://update.code.visualstudio.com/latest/server-linux-x64/stable" -o vscode-server-linux-x64.tar.gz
mkdir -p ~/.vscode-server/bin/${commit_id}
# assume that you upload vscode-server-linux-x64.tar.gz to /tmp dir
tar zxvf vscode-server-linux-x64.tar.gz -C ~/.vscode-server/bin/${commit_id} --strip 1
@CSUwangj
CSUwangj / test.md
Created September 20, 2020 17:04
get zola panic.md

+++ title = "2019-02-17 Daily Challenge" date = 2019-02-17T01:04:46+00:00 updated = 2020-09-19T20:01:27.631316+00:00 description = "DailyChallenge" in_search_index = true

[taxonomies] tags = [ "Math", "ProjectEuler", "Algorithm", "LeetCode",] categories = [ "DailyChallenge",]

@CSUwangj
CSUwangj / receiver-demo.html
Created September 10, 2020 08:40 — forked from GitSquared/receiver-demo.html
Use your browser to access a remote terminal.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Remote terminal</title>
<link rel="stylesheet" href="xterm.css" />
<script src="terminal.class.js"></script>
@CSUwangj
CSUwangj / multi_threads.py
Created April 10, 2019 08:40
[python] multi-threads with a maximum number of simultaneous threads
import queue
import threading
num_worker_threads = 10
source = range(1000)
def do_work(item):
print(item)
def worker():
@CSUwangj
CSUwangj / multi_process.py
Created April 10, 2019 08:36
[python] multi-process with a maximum number of simultaneous processes
from multiprocessing import Pool, TimeoutError
import time
import os
def f(x):
return x*x
if __name__ == '__main__':
# start 4 worker processes
with Pool(processes=4) as pool: