-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc_custom
63 lines (56 loc) · 1.6 KB
/
.bashrc_custom
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env bash
function rndpwd() {
openssl rand -base64 32
}
# git
function gspp() {
not_clean=$(if [ -n "$(git status --porcelain)" ]; then echo true; else echo false; fi)
dt=$(date '+%Y-%m-%d_%H:%M:%S')
if [ $not_clean = true ] ; then
git stash push -u -m "$dt"
fi
git pull --rebase
if [ $not_clean = true ] ; then
git stash pop
fi
git add -A
git reset
}
# npm rush register
function npm_reg() {
# ~/d is the directory where i develop
cd ~/d
mkd "$1"
npm init -y
# version `0.0.0` instead of `1.0.0`
cat package.json | \
js -to 'x.version = `0.0.0`, JSON.stringify(x, null, 2)+`\n`' \
> package.json
npm publish
}
# short for imagemin
function imgmin() {
imagemin $1 --out-dir .
}
# prepend text to file
# https://unix.stackexchange.com/questions/56975/whats-the-command-to-prepend-a-line-to-a-file
function prepend() {
local text=$2
local file=$1
local tmpfile="$file.prepend.tmp"
(echo $text; cat $file) > $tmpfile; mv $tmpfile $file
}
export PATH=$PATH:$HOME/bin
alias k=kanban
# proxy
function proxy_on() {
export https_proxy=http://127.0.0.1:8118 http_proxy=http://127.0.0.1:8118 all_proxy=socks5://127.0.0.1:8119
export HTTPS_PROXY=http://127.0.0.1:8118 HTTP_PROXY=http://127.0.0.1:8118 ALL_PROXY=socks5://127.0.0.1:8119
# Proxies and VPNs | minikube
# https://minikube.sigs.k8s.io/docs/handbook/vpn_and_proxy/
export NO_PROXY=localhost,127.0.0.1,10.96.0.0/12,192.168.59.0/24,192.168.49.0/24,192.168.39.0/24
}
function proxy_off() {
unset https_proxy http_proxy all_proxy
unset HTTPS_PROXY HTTP_PROXY ALL_PROXY
}