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 / 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
@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-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 / 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 / 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 / dl-wiki.py
Last active December 9, 2024 05:31
Download and Convert a Wikipedia page to Markdown with LaTeX math expressions.
#!/usr/bin/env python3
# coding: utf-8
# Requirements:
# pip3 install bs4 markdownify requests
# Usage:
# dl-wiki.py https://en.wikipedia.org/wiki/Formal_derivative
import sys