Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀
Rustacean

Garden Yuen weaming

🦀
Rustacean
View GitHub Profile
@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 ssh-with-password.sh
#!/bin/bash
# macos: brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb
user=$1
ip_or_tail=$2
if echo $ip_or_tail | grep -E '\.' >/dev/null; then
user_host=$user@$ip_or_tail
else
user_host=$user@192.168.1.$ip_or_tail
@weaming
weaming / jpeg-convert-color-space.py
Last active Jul 21, 2021
CLI to convert or assign colorspace of JPEG
View jpeg-convert-color-space.py
#!/usr/bin/env python3
# Author : weaming
# Mail : garden.yuen@gmail.com
# Created : 2021-07-12 15:07:12
# 解决以下几个方面的问题:色彩空间、文件压缩、EXIF 处理、水印
import argparse
import io
import os
from PIL import Image
View fzf_tab_binding.fish
# inspired by https://github.com/junegunn/fzf/issues/868
function __fzf_ls_files
git ls-tree -r --name-only HEAD 2>/dev/null; or fd --type f --hidden --follow --exclude .git
end
function __fzf_grep_last
set -l cmd (commandline)
# default complete all, and compatible with fzf `**<TAB>`
if str_endswith "$cmd" ' '; or test $cmd = '**'
@weaming
weaming / boostnote2md.py
Last active Apr 11, 2021
Convert boostnote cson format data to markdown
View boostnote2md.py
#!/usr/bin/env python3
# coding: utf-8
"""
Author : weaming
Created Time : 2018-05-26 21:32:59
Prerequisite:
python3 -m pip install cson arrow
"""
import json
import os
View all-symbols-2021-04-03T17-59-09.txt
ETHBTC
LTCBTC
BNBBTC
NEOBTC
QTUMETH
EOSETH
SNTETH
BNTETH
BCCBTC
GASBTC
View async-in-Python3.md

async in Python3

History

  1. generators found in Python 3.3
  2. event loop in the form of asyncio: In Python 3.4, the asyncio.coroutine decorator was used to label a function as acting as a coroutine that was meant for use with asyncio and its event loop.
  3. yield from to await in Python 3.5

Event loop and task

View simple-trace.go
import (
"fmt"
"log"
"os"
"sync"
"time"
)
var KEEP_CALLS = os.Getenv("KEEP_CALLS") != ""
View str-as-marshaljson-of-time-duration.go
package main
import (
"bytes"
"encoding/json"
"fmt"
"time"
)
type Duration struct {
@weaming
weaming / git-aliases.bash
Last active Feb 5, 2021
使用 alias 提高 git 使用效率
View git-aliases.bash
alias gcl='git clone'
alias gs='git status'
alias gd='git diff'
alias gdc='git diff --cached'
alias gl='git lg'
alias gps='git push -u'
alias gconf='vi .git/config'
alias gamend='git commit --amend'
alias gamendy='git commit --amend --no-edit'
alias gback='git reset --hard HEAD~'