Skip to content

Instantly share code, notes, and snippets.

View virus-warnning's full-sized avatar

Raymond Wu virus-warnning

  • Taiwan
View GitHub Profile
@virus-warnning
virus-warnning / update_osm.py
Last active April 25, 2018 10:50
台灣圖資自動更新程式
# coding: utf-8
#
# 台灣 OSM 圖資自動更新程式,會自動檢查更新,有更新時下載,並且匯入到 PostGIS
#
# 系統需求:
# * wget
# * osm2pgsql 並且內含 PBF 圖資格式支援
#
# 測試環境:
# * Ubuntu 14.04.1 LTS
@virus-warnning
virus-warnning / burial_tw.svg
Last active April 7, 2016 09:13
台灣殯葬方式流程圖
Loading
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 / async_pdca.py
Last active December 21, 2018 17:05
用管理學的 PDCA 循環理解 Python 3.7 的非同步處理
import random
import asyncio
class PDCACycle:
def __init__(self):
self.bad_mood = 0
self.interval = 1
async def plan(self, name):
@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
@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 / 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 / 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 / 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 / security_firms.geojson
Created November 20, 2019 04:53
全台券商位置
Loading
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 / 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: