Skip to content

Instantly share code, notes, and snippets.

View virus-warnning's full-sized avatar

Raymond Wu virus-warnning

View GitHub Profile
@virus-warnning
virus-warnning / rwqueue.py
Created June 18, 2021 18:59
測試 asyncio.Queue 的效率與 CPU 佔用邏輯
'''
I/O test for asyncio.Queue
QSIZE = 300000
QFILL = 300000
FORCE_SWITCH = False
enqueue(): Put 100000 items.
enqueue(): Put 200000 items.
enqueue(): Put 300000 items.
@virus-warnning
virus-warnning / ubuntu20+wine.txt
Created May 12, 2020 06:47
Ubuntu 20 容器安裝 Wine Stable
FROM ubuntu:20.04
# 先把套件庫切換到國網中心加速
RUN sed -i 's/\(archive\|security\).ubuntu.com/free.nchc.org.tw/' /etc/apt/sources.list && \
dpkg --add-architecture i386 && \
apt-get update
# 搞定時區問題
# 如果沒處理, 安裝 software-properties-common 可能會弄爛
RUN export DEBIAN_FRONTEND=noninteractive && \
@virus-warnning
virus-warnning / coolpc_gpu.py
Created April 29, 2020 09:41
原價屋顯卡報價監測
import os
import re
import sys
import hashlib
import time
import locale
import requests
from bs4 import BeautifulSoup
@virus-warnning
virus-warnning / ps_exec.py
Created January 16, 2020 09:17
使用 PowerShell 執行程式, 回傳 STDOUT, 並且支援系統管理員身分執行
import os
import random
import subprocess
def ps_exec(cmd, adminPriv=False):
""" 使用 Windows PowerShell Start-Process 執行程式, 回傳 STDOUT, 並且支援以系統管理員身分執行 """
# 產生隨機檔名, 用來儲存 stdout
existed = True
while existed:
@virus-warnning
virus-warnning / security_firms.geojson
Created November 20, 2019 04:53
全台券商位置
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@virus-warnning
virus-warnning / classify.py
Created September 4, 2019 06:39
Classify photos by EXIF attributes, designed for my wife.
"""
Classify photos by EXIF attributes.
Before classified:
DCIM
├── 100ANDRO
│   ├── DSC_2828.JPG
│   └── DSC_2830.JPG
├── 99ANDRO
@virus-warnning
virus-warnning / ticks_by_location.py
Last active March 14, 2024 06:53
分點進出取資料研究
import io
import json
import os
import re
import requests
import sys
import tkinter as tk
from PIL import ImageTk, Image
from bs4 import BeautifulSoup
@virus-warnning
virus-warnning / diffpenis.py
Last active May 23, 2019 07:08
重複漢字測試
#!/usr/bin/env python3
# Unicode 重複漢字測試
#
# 參考: http://maraboy.com/node/83
#
# 執行結果:
# 你的 [懶叫] 跟我的 [懶叫] 不一樣
# * 你的 [懶叫] 編碼是: [F90D,53EB]
# * 我的 [懶叫] 編碼是: [61F6,53EB]
# 用 [NFC] 喬一下你的 [懶叫] 和我的 [懶叫]
@virus-warnning
virus-warnning / pycairo_chinese.py
Last active April 17, 2019 01:11
讓 pycairo 可以正常顯示中文的賤招,需要利用 wxPython
import subprocess
import cairo
import wx
import wx.lib.wxcairo
WIDTH = 400
HEIGHT = 300
surface = cairo.ImageSurface(
@virus-warnning
virus-warnning / detect_unlock.py
Last active December 28, 2018 09:51
檢查 MacOS 有沒有發生解除鎖定事件
'''
log show --style syslog \
--start "2018-12-26 18:00:00" \
--predicate 'process == "loginwindow"' \
| grep 'unlock'
'''
import os
import time
import datetime