Skip to content

Instantly share code, notes, and snippets.

🍊
Focusing

garden.yuen weaming

🍊
Focusing
View GitHub Profile
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")
@weaming
weaming / st_heap.py
Last active May 21, 2020
数据结构:堆 heap
View st_heap.py
# Created : 2020-05-22 00:14:21
# 创建和调整:https://zhuanlan.zhihu.com/p/77527032
# 插入和删除:https://www.jianshu.com/p/e0a40d6748b8
import operator
default_op = operator.ge
def heap_adjust(A, i, size, op):
@weaming
weaming / aliyun-dm-send-email.py
Last active May 16, 2020
阿里云邮件推送服务 Python 发送示例
View aliyun-dm-send-email.py
"""
https://dm.console.aliyun.com/
https://help.aliyun.com/document_detail/29444.html
https://www.jeesns.cn/article/detail/3422
https://text-compare.com/
"""
import time, datetime
import hmac
import base64
from urllib.parse import quote
View MacOS X El Capitan with Vagrant - MacOS X VM on Windows or Linux.md
@weaming
weaming / haproxy.cfg
Created May 11, 2020 — forked from cmer/haproxy.cfg
Simple, no bullshit TCP port forwarding using HAProxy
View haproxy.cfg
listen l1
bind 0.0.0.0:443
mode tcp
timeout connect 4000
timeout client 180000
timeout server 180000
server srv1 host.example.com:9443
View shortkeys.export.json
[{"key":", .","action":"javascript","blacklist":false,"sites":"*mail.google.com*","open":false,"code":"location.pathname = '/';","exported":true,"sitesArray":["*mail.google.com*"],"customName":"goto root"},{"key":", ,","action":"javascript","blacklist":false,"sites":"*mail.google.com*","open":false,"code":"location.search = \"\";\nlet newPath = location.pathname\n .split(\"/\")\n .filter(x => x.length > 0)\n .slice(0, -1)\n .join(\"/\");\nlocation.pathname = newPath;","customName":"goto upper","exported":true,"sitesArray":["*mail.google.com*"]}]
View setup-kubeless-on-ubuntu.sh
apt-get update; apt-get install -y curl wget unzip
curl -sfL https://get.k3s.io | sh -
kubectl create ns kubeless
kubectl create -f https://github.com/kubeless/kubeless/releases/download/v1.0.6/kubeless-v1.0.6.yaml
wget https://github.com/kubeless/kubeless/releases/download/v1.0.6/kubeless_linux-amd64.zip -O kubeless.zip; \
unzip kubeless.zip; \
mv bundles/kubeless_linux-amd64/kubeless /usr/local/bin; \
rm -rf bundles/ kubeless.zip
View emojione.css
@font-face {
font-family: 'EmojiOne';
src: url('https://github.com/joypixels/emojione-assets/releases/download/4.5/emojione-android.ttf');
}
You can’t perform that action at this time.