Skip to content

Instantly share code, notes, and snippets.

View Jerry0420's full-sized avatar
🏠
Looking for a remote job.

Yen Lung Wang Jerry0420

🏠
Looking for a remote job.
View GitHub Profile
@Jerry0420
Jerry0420 / 1.py
Last active November 20, 2022 14:47
def learning_path(first: str, second: str, third: str, fourth: str, target: str) -> str:
record: Dict[str, List[str]] = {}
for i in [first, second, third, fourth]:
rule = i.split(" ")
if len(rule) == 1:
record[rule[0]] = []
else:
if rule[0] not in record:
record[rule[0]] = []
rule[1:].sort()
@Jerry0420
Jerry0420 / README.md
Last active June 17, 2023 09:41
An logger tool written in Python.
  • Thread-Safe between multiple processes.
  • No need for any dependency.
@Jerry0420
Jerry0420 / README.md
Last active May 2, 2022 19:36
An logger tool written in Golang.
  • Logger file Auto-Rotation.
  • Thread-Safe
  • No need for any dependency.
@Jerry0420
Jerry0420 / README.md
Last active May 2, 2022 19:37
A Pub-Sub tool written in Golang.
  • Thread-Safe
  • No need for any dependency.
@Jerry0420
Jerry0420 / KillableThread.py
Last active May 3, 2022 03:13
Python Killable Thread
import threading
import sys
class KillableThread(threading.Thread):
def __init__(self, *args, **keywords):
threading.Thread.__init__(self, *args, **keywords)
self.killed = False
def start(self):
self.__run_backup = self.run
package main
import (
"io"
"net/http"
)
func sayhello(res http.ResponseWriter, req *http.Request) {
io.WriteString(res, "hello world")
}
#!/usr/bin/env python3
import requests
from bs4 import BeautifulSoup
import json
import re
def main(document):
document = BeautifulSoup(document, 'lxml')
result = {}
import requests
import time
import asyncio
import functools
# async IO is a single-threaded, single-process design
# event_loop
# coroutine
# task
# future
#!/bin/bash
# 賦值
pathName='hello world'
# echo 是列印值,印出變數 pathName 內容 demo.sh
echo ${pathName}
# $$ 目前 process PID
# ${0} 為檔名
from email.message import EmailMessage
import smtplib
content = '''<html><body><table style="margin-bottom: 0px; border:1px solid #d8d8d8;"><thead><tr><th>Index</th><th>Count</th><th>Del after 6 Hrs</th><th>Rate</th><th>Extension Enable</tr></th></thead><tbody>\n'''
for i in alarms:
content += '<tr><td>{}</td><td>{:,}</td><td>{:,}</td><td>{}</td><td>{}</td></tr>\n'.format(i[0], i[1], i[2],
round(i[2] / i[1], 3), gc_nindex.get(i[0], ''))
content += '</tbody></table><table><tr><td>TTL 關掉的 index</td></tr>\n'
for i in sweeper.disabled:
content += '<tr><td>{}</td></tr>'.format(i)