This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 && \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
import sys | |
import hashlib | |
import time | |
import locale | |
import requests | |
from bs4 import BeautifulSoup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import random | |
import subprocess | |
def ps_exec(cmd, adminPriv=False): | |
""" 使用 Windows PowerShell Start-Process 執行程式, 回傳 STDOUT, 並且支援以系統管理員身分執行 """ | |
# 產生隨機檔名, 用來儲存 stdout | |
existed = True | |
while existed: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Classify photos by EXIF attributes. | |
Before classified: | |
DCIM | |
├── 100ANDRO | |
│ ├── DSC_2828.JPG | |
│ └── DSC_2830.JPG | |
├── 99ANDRO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Unicode 重複漢字測試 | |
# | |
# 參考: http://maraboy.com/node/83 | |
# | |
# 執行結果: | |
# 你的 [懶叫] 跟我的 [懶叫] 不一樣 | |
# * 你的 [懶叫] 編碼是: [F90D,53EB] | |
# * 我的 [懶叫] 編碼是: [61F6,53EB] | |
# 用 [NFC] 喬一下你的 [懶叫] 和我的 [懶叫] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import cairo | |
import wx | |
import wx.lib.wxcairo | |
WIDTH = 400 | |
HEIGHT = 300 | |
surface = cairo.ImageSurface( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
log show --style syslog \ | |
--start "2018-12-26 18:00:00" \ | |
--predicate 'process == "loginwindow"' \ | |
| grep 'unlock' | |
''' | |
import os | |
import time | |
import datetime |
NewerOlder