Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀
Rustacean

Garden Yuen weaming

🦀
Rustacean
View GitHub Profile
@weaming
weaming / macOS-like.ahk
Last active Dec 2, 2020
模仿 #macOS 的 #AutoHotKey 的脚本,主要是把 Alt 键当成 Ctrl 键来用,另外就是 CMD + a/e 调到行首/行尾,还在 CMD + Shift + 箭头来切换 chrome 标签页。
View macOS-like.ahk
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
#SingleInstance Force
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
CapsLock::Esc
return
@weaming
weaming / caiyun-translate-for-tampermonkey.js
Created Sep 24, 2020
彩云小译油猴脚本,添加按钮开启翻译!
View caiyun-translate-for-tampermonkey.js
// ==UserScript==
// @name 彩云小译
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 彩云小译自制脚本
// @author github@weaming
// @include *
// @grant none
// ==/UserScript==
View shared-class-variable-references.py
#!/usr/bin/env python3
class C:
a = 1
def __init__(self):
self.a += 1
def update(self):
@weaming
weaming / generate-sqalchemy-model-code.py
Created Jul 19, 2020
根据 csv 生成 SQLAlchemy models 代码
View generate-sqalchemy-model-code.py
#!/usr/bin/env python3
# Author : weaming
# Mail : garden.yuen@gmail.com
# Created : 2020-07-19 21:01:50
# Usage:
# csv_json: pip3 install pretty-format-json
# xsv: brew install xsv
# cat esf-nn-rst.csv | xsv stats | csv_json | generate-sqalchemy-model-code.py
View sort by tech indicators and market value.md
名称 代码 交易平台 交易量 市值 最新价 涨跌幅 技术5分钟 技术15分钟 技术30分钟 技术每小时 技术5小时 技术每天 技术每周 技术每月 value count
Bank of America Corp Pl Pref BAC_pl 纽约 2.10K 207690000000.0 1378.18 0.38 强力买入 强力买入 强力买入 强力买入 强力买入 强力买入 强力买入 强力买入 强力买入 8
贝莱德 BLK 纽约 113.72K 87740000000.0 569.03 0.08 强力买入 强力买入 强力买入 强力买入 强力买入 强力买入 强力买入 强力买入 强力买入 8
直觉外科公司 ISRG 纳斯达克 296.26K 70430000000.0 605.69 -0.35 强力买入 强力买入 强力买入 强力买入 强力买入 强力买入 强力买入 强力买入 强力买入 8
宣伟公司 SHW 纽约 114.31K
View ctrip-crawler-example.py
#!/usr/bin/env python3
# Author : weaming
# Mail : garden.yuen@gmail.com
# Created : 2020-07-15 14:05:23
import pdb
import os
from typing import Optional
View alembic-graph
#!/usr/local/bin/python3
# Created : 2020-07-16 13:06:10
import sys
import os
from graphviz import Digraph
fmt = os.getenv('GRAPH_FMT', 'dot')
dot = Digraph(comment='alembic', format=fmt)
View patch_requests.py
import json
from functools import wraps
import requests
allow_methods = [
'options',
'head',
'get',
'post',
@weaming
weaming / install-python-with-tk-supported-via-pyenv-on-macos.sh
Last active Jun 2, 2020
Install python with tk supported via pyenv on macOS.
View install-python-with-tk-supported-via-pyenv-on-macos.sh
#!/usr/bin/bash
# https://github.com/pyenv/pyenv/issues/1375#issuecomment-524280004
# NOTE: following steps does work on my macOS 10.15.4, pyenv 1.2.18 :(
# Error example:
# ERROR: invalid Python executable: /Users/weaming/.pyenv/versions/3.8.2/bin/python3.8
# The python-build could not find proper executable of Python after successful build.
# Finally solution: download .pkg installer from https://www.python.org/downloads/release/python-382/
# it includes its own private version of Tcl/Tk 8.6. It does not use any system-supplied or third-party supplied versions of Tcl/Tk.
View elisp-in-15-min.el
(+ 1 (+ 3 4))
(setq name "weaming")
(defun hello (name) (insert "Hello, " name))
(hello "weaming")
(switch-to-buffer-other-window "*test*")
(progn
(switch-to-buffer-other-window "*test*")
(erase-buffer)
(hello "you")