Skip to content

Instantly share code, notes, and snippets.

View drmingdrmer's full-sized avatar
🙃
coding bit by bit

张炎泼 drmingdrmer

🙃
coding bit by bit
View GitHub Profile
@drmingdrmer
drmingdrmer / voice-input.py
Last active October 23, 2023 00:45
Voice input in CLI and vim, via azure speech service
#!/usr/bin/env python
# coding: utf-8
# Enable azure speech service:
# https://docs.azure.cn/zh-cn/ai-services/speech-service/get-started-speech-to-text?tabs=macos%2Cterminal&pivots=programming-language-python
#
# Setup environement variables key and region that are found at page
# https://portal.azure.com
# Home -> Azure AI Service | Speech service -> <your_service_name>
#
@drmingdrmer
drmingdrmer / git-history-msg
Last active July 12, 2019 06:04
Batch replace word in commit messages with: git history-msg typo type origin/master..mydev_branch
#!/bin/sh
usage(){
cat <<-END
git history-msg <from> <to> <spec>
Replace word <from> to <to> in commit message.
Install:
copy it into /usr/local/bin/ or somewhere PATH env can find.
@drmingdrmer
drmingdrmer / git-split
Last active November 25, 2020 05:49
Split one git history into two
#!/bin/bash
usage()
{
cat <<-END
Split one git history into two.
One of them only contains changes of specified files.
The other contains other changes(or optionally contains full history).
@drmingdrmer
drmingdrmer / p8ln
Last active March 22, 2022 14:29
Format python source codes with autopep8 on only changed lines
#!/bin/sh
# Format python source codes with autopep8 on changed lines.
#
# Usage:
# format all uncommitted lines:
# > p8ln
#
# format file:
# > p8ln a.py b.py
@drmingdrmer
drmingdrmer / git-subrepo
Last active March 25, 2019 05:39
add/update git sub repository with git-subtree by reading a config file
#!/bin/sh
clr()
{
# clr light read blabla
local black=0
local white=7
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
@drmingdrmer
drmingdrmer / git-gotofix
Last active December 15, 2019 08:20
git-gotofix: go back to an earlier commit in which <fn> is modified.
#!/bin/sh
usage()
{
cat >&2 <<-END
usage: git gotofix <fn>
Fix <fn> at the commit where <fn> is lastly modified.
And get HEAD back to where before using git-gotofix.
@drmingdrmer
drmingdrmer / git-box
Last active December 11, 2023 13:57
watch and auto fetch/rebase/merge/push git-repo.
#!/bin/bash
# Usage:
# 1. create config file ~/.gitbox.conf
#
# cat ~/.gitbox.conf
# ~/xpkit fetch,push
# ~/wiki
#
# # format:
#!/usr/bin/env python2.6
# coding: utf-8
import types
# DOUBLE_LINE_MAP = [ u'\u2800\u2880\u28a0\u28b0\u28b8',
# u'\u2840\u28C0\u28E0\u28F0\u28F8',
# u'\u2844\u28C4\u28E4\u28F4\u28FC',
  1. 只管去做。

    Just do it

  2. 1%的决策,都可以更改。

    1% of decisions aren't permanent

  3. 招人要慎重,解雇要快速。