Skip to content

Instantly share code, notes, and snippets.

@QinMing
QinMing / reset_line_ending.py
Last active December 14, 2020 04:06
Set the correct line ending, either CRLF or LF, for a directory tree
#!/usr/bin/env python3
#
# Sample Usage:
# <command> '.*\.html'
import logging
import os
import re
from argparse import ArgumentParser
@QinMing
QinMing / .zshrc
Last active January 4, 2022 19:38
my very own zshrc
# Copyright (c) 2016-2021 Ming Qin (覃明) <https://github.com/QinMing>
# Open source under MIT LICENSE.
export PATH=/usr/local/bin:$PATH
export ZSH="$HOME/.oh-my-zsh"
DISABLE_MAGIC_FUNCTIONS=true
# So that it doesn't add the extra excape character. Without this line, pasting `mingq.in/?param` will become `mingq.in/\?param`
ZSH_THEME="agnoster"
@QinMing
QinMing / git_profile.sh
Last active April 8, 2022 00:35
My git configurations, mainly alias. Just need to run it once.
#!/bin/bash
git config --global user.name "Ming Qin"
git config --global user.email "$email_address"
git config --global push.default current
git config --global alias.l "log --stat --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %C(blue)(%an %ch)%Creset%n' --abbrev-commit"
git config --global alias.last "log -1 HEAD"
git config --global alias.a "add"
git config --global alias.b "branch -v --sort=committerdate"
git config --global alias.c "commit"
@QinMing
QinMing / .zshrc
Last active May 13, 2024 05:27
.zshrc (lazy loading shell functions)
# Copyright (c) 2016-2018 Ming Qin (覃明) <https://github.com/QinMing>
# Open source under MIT LICENSE.
lazy_load() {
# Act as a stub to another shell function/command. When first run, it will load the actual function/command then execute it.
# E.g. This made my zsh load 0.8 seconds faster by loading `nvm` when "nvm", "npm" or "node" is used for the first time
# $1: space separated list of alias to release after the first load
# $2: file to source
# $3: name of the command to run after it's loaded
# $4+: argv to be passed to $3