Skip to content

Instantly share code, notes, and snippets.

View jaredyam's full-sized avatar
👫
Falling in love with Wu.

jaredyam

👫
Falling in love with Wu.
  • Beijing, China
View GitHub Profile

Improved Keymap of Sublime Text 3 AutoDocstring Package

TL;DR

Auto-add docstrings by entering the newline when it's needed.

Prerequisite packages

  1. Package Control
# Rename conda env and redirect bash shebang to new env.
#
# Reference
# ---------
# https://stackoverflow.com/a/62853056/11533669
# rename
# The two variables below should be something like path str or filename if the file presents in current directory
mv $OLD_ENV_NAME $NEW_ENV_NAME
# Print out all PATH environment variables with \newline separated.
alias path='echo -e ${PATH//:/\\n}'
# Get today's date and pipe it to the system clipboard.
alias today='date +"%Y%m%d" | pbcopy'
# Update all packages managed by homebrew and gem (if you've installed them).
alias updateall='brew update && brew upgrade && brew cleanup && gem update && gem cleanup && brew doctor'
# Instantly create a public gist and open it with the default browser,
@jaredyam
jaredyam / subl-zsh.sh
Last active November 14, 2020 10:21
Fix the issue that [project-name].sublime-project setting file not works when open sublime project with the terminal command [subl project-directory]
# Wrap up the [subl] command with the ability that auto-activate the .sublime-project setting file under project directory.
#
# relative issue / solution
# -------------------------
# 1. https://stackoverflow.com/questions/14203944/sublime-text-folder-exclude-patterns-stopped-working
# 2. https://forum.sublimetext.com/t/project-settings-when-opened-with-subl/11419
# 3. https://gist.github.com/imjared/7010577
function subl() {
sublime_project_file="${1##*/}.sublime-project"
#! /usr/bin/env python3
"""Combine multiple screenshots with the same shape.
Usage
-----
1. Specify a list of screenshots.
stitch-videoshots screenshot1 screenshot2 screenshot3
2. Specify a dictionary contains screenshots.
stitch-videoshots -d ./mypath [--sort]
"""Print out the current directory's tree structure to console.
Inspired by the `colorls --tree` command from the open source codebase Colorls
references
----------
https://github.com/athityakumar/colorls/blob/a7006a5fd3eba6945ee29a499e4db72bdcc26114/lib/colorls/core.rb#L351
"""
@jaredyam
jaredyam / mktree.py
Last active November 6, 2020 08:59
Create the target directory tree structure based on an indent-aligned text file.
#!/usr/bin/env python3
"""Create the target directory tree structure based on an indent-aligned text file.
Usage
-----
python mktree.py tree[.txt]
Test demo
-----------------
$ cat tree
# Instantly create a gist and save it as a local repo.
# Prerequisites: brew install hub
# Usage: gist [file-to-share]
function gist() {
hub gist create --public -o -c "$1"
__url=$(pbpaste)
git clone "$__url" && mv "${__url##*/}" "${1%.*}" && rm "$1" && cd "${1%.*}"
}
# Move files to the system trash.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""Plot 3d figures with Python.
References
----------
1. https://stackoverflow.com/questions/8722735/i-want-to-use-matplotlib-to-make-a-3d-plot-given-a-z-function
2. https://stackoverflow.com/questions/31768031/plotting-points-on-the-surface-of-a-sphere-in-pythons-matplotlib
"""