Skip to content

Instantly share code, notes, and snippets.

@nehaljwani
Last active June 26, 2020 16:16
Show Gist options
  • Save nehaljwani/007f0eaebb814a9556fa03c24098c8c3 to your computer and use it in GitHub Desktop.
Save nehaljwani/007f0eaebb814a9556fa03c24098c8c3 to your computer and use it in GitHub Desktop.
NJW's dotrc
alias urldecode='python2.7 -c "import sys, urllib as ul; \
print ul.unquote_plus(sys.argv[1])"'
aria2c_ka() {
aria2c $(urldecode $1 | grep -wo 'magnet.*')
}
cfget () {
git clone https://github.com/conda-forge/$(pwd | awk -F'/' '{print $NF}')-feedstock
}
cfrebase() {
git pull --rebase https://github.com/conda-forge/$(pwd | tr '/' '\n' | grep feedstock) $@
}
git-add-nwani() {
git remote add nwani $(git config --get remote.origin.url | awk -F'/' '{$4="nehaljwani"}1' OFS='/')
}
github-fetch-pr() {
github_username=${1%:*}
github_branch=${1#*:}
git fetch $(git remote get-url origin | sed "s,\(github.com[:/]\)\([^/]\)*,\1${github_username},g") ${github_branch}
}
gotoscratch() {
mkdir -p /tmp/scratch.nwani/$(date +%s)
cd $_
}
regro-push () {
git push https://github.com/regro-cf-autotick-bot/$(pwd | tr '/' '\n' | grep feedstock) HEAD:"$(echo $1 | awk -F: '{print $NF}')"
}
regro-rebase() {
git pull --rebase https://github.com/regro-cf-autotick-bot/$(pwd | tr '/' '\n' | grep feedstock) "$(echo $1 | awk -F: '{print $NF}')"
}
random-string() {
LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | fold -w ${1:-12} | head -1
}
regro-push () {
git push https://github.com/regro-cf-autotick-bot/$(pwd | tr '/' '\n' | grep feedstock) HEAD:"$@"
}
# Concat PDFs
# gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=out.pdf in1.pdf in2.pdf
transfer() {
curl --progress-bar --upload-file "$1" https://transfer.sh/$(basename $1) | tee /dev/null;
}
tscp() {
scp -v -o ProxyCommand='/usr/local/bin/ncat --proxy 127.0.0.1:9890 --proxy-type socks5 %h %p' $@
}
tssh() {
ssh -o ProxyCommand='/usr/local/bin/ncat --proxy 127.0.0.1:9890 --proxy-type socks5 %h %p' $@
}
steal_ssh_agent() {
export SSH_AUTH_SOCK=$(find /tmp/ssh-*/ 2>/dev/null | grep agent | head -1)
}
# Remove the -u option if you want to convert it to your local timezone instead of UTC.
function nanots {
date -d "@0$(echo "$1 / 10^9" | bc -l)" -u "+%D %T.%N %Z"
}
@anandsinghkunwar
Copy link

In prezto zsh shell, find has been aliased to noglob find, maybe changing to $(/usr/bin/find ..) makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment