Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀
Rustacean

Garden Yuen weaming

🦀
Rustacean
View GitHub Profile
@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 all-symbols-2021-04-03T17-59-09.txt
ETHBTC
LTCBTC
BNBBTC
NEOBTC
QTUMETH
EOSETH
SNTETH
BNTETH
BCCBTC
GASBTC
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 {
View cli using builtin package flag.go
package main
import (
"flag"
"fmt"
"os"
"strings"
)
type Cli struct {
@weaming
weaming / confirm.go
Created Feb 3, 2021 — forked from r0l1/confirm.go
Go (golang): How to ask for user confirmation via command line
View confirm.go
/* MIT License
*
* Copyright (c) 2017 Roland Singer [roland.singer@desertbit.com]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
View filecoin-project-lotus.csv
where type name sha remote
local tag 0.7.0-rc1 cd9a8ecfa9d7a810e42717ddc93ae066880d6519
local tag 0.9.1-pre1 26ed6af0405b027470b88f893577d35fca9af5bd
local tag 1.1.0-pre1 8f4ab925fafb7b7d5f565d0561f149d17edbda59
local tag interop.5.13 d11e375f828526eab2a59fd6fd3db88e3c5cb9d3
local tag interop.6.1 06670f4caecc9b37fc4b1467e4447359f92852f0
local tag interop.6.16.0 bead3bf412954c02ac82e5367e6e9c498a8a897b
local tag interop.6.5 613226dec59d3ed2a48b228aa8ed5c1ca7cdafe8
local tag interop.6.6 4068c9a7d863d56347f3256566889b909d2cc51b
local tag interop.6.8 96a5e579cfb3fdb67bd2c22b202db3c312928995
View single-producer-multi-consumers.py
import queue
import threading
import traceback
import sys
def map_do(fn, iterable, n=20):
from concurrent.futures import ThreadPoolExecutor
with ThreadPoolExecutor(n) as executor:
@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~'
@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