Skip to content

Instantly share code, notes, and snippets.

@ZhengRui
ZhengRui / countloc.zsh
Created May 11, 2025 08:49
count lines of code in your git repo or a folder
countloc() {
local exclude_ext="webp|ttf|json|png|lock|lockb|svg|jpg|jpeg|gif|ico|pdf|zip|tar|gz|mp3|mp4|woff|woff2|eot"
local exclude_dirs=".venv|node_modules|.git|dist|build|coverage|__pycache__|.next|.cache"
local force=0
local breakdown=0
local help=0
local languages=()
local selected_extensions=()
local dir="." # Default directory is current directory
@ZhengRui
ZhengRui / LiveReload.sublime-settings
Last active June 20, 2021 10:06
SublimeText3 Markdown Preview + LiveReload + Pandoc User Settings
{
"enabled_plugins": [
"SimpleReloadPlugin",
"SimpleRefresh"
]
}
@ZhengRui
ZhengRui / config
Created May 26, 2016 05:55
i3 configuration
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout somewhen, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
@ZhengRui
ZhengRui / .vimrc
Last active January 23, 2017 09:24
ubuntu14.04 vim and neovim configuration
" add for vundle
set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
@ZhengRui
ZhengRui / pyqt4RectSelectByStroke.py
Last active May 25, 2016 11:25
pyqt4 rectangle select by edge/stroke
from PyQt4 import QtGui, QtCore
import sys
class QStrokeRect(QtGui.QGraphicsRectItem):
def __init__(self, parent=None):
super(QStrokeRect, self).__init__(parent)
self.strokeWidth = 4
self.setPen(QtGui.QPen(QtGui.QColor(255, 0, 0), 4, QtCore.Qt.SolidLine))
self.setFlags(QtGui.QGraphicsItem.ItemIsSelectable)
@ZhengRui
ZhengRui / updateMatplotlibPlot.py
Last active March 28, 2020 21:31
Update Matplotlib Plot
#! /usr/bin/env python
import matplotlib
import matplotlib.pyplot as plt
matplotlib.style.use("ggplot")
import numpy as np
import time
def newfig(l):