[manual-pull] Merge branch 'main' of the remote into main

Haha pull not really gone hur durr again.

Signed-off-by: Andrei Jiroh Halili <andreijiroh@madebythepins.tk>
This commit is contained in:
Andrei Jiroh Eugenio Halili 2021-04-11 20:27:41 +08:00
commit 6b639673a6
Signed by: ajhalili2006
GPG Key ID: A30EBE40AD856D88
7 changed files with 140 additions and 11 deletions

View File

@ -1,14 +1,58 @@
#!/bin/bash
# shortcuts to Git
##################################################
# #
# AN NOTE ON ADDING ALIASES INTO HERE: #
# #
##################################################
# #
# I don't like to implement every single #
# shortcuts as an script in the .dotfiles/bin #
# directory, bacause it mostly consume my time on#
# testing and formatting shit. #
# #
# So for people who forked my dotfiles repo, I #
# recommend to only create an alias on simple #
# commands or as an shortcut to scripts provided #
# in .dotfiles/bin or ~/.toolkit-mgr-bin. Also #
# when adding aliases, make sure the real command#
# is an one-liner. For those who want to go on an#
# multi-line chaos, good luck to y'all. #
# #
# For noobs/newbies, the syntax is: #
# alias here-owo="real-stuff --goes here" #
# #
##################################################
# basic git commands
alias stats="git status"
## shortcuts to creating commits
alias commit="git commit --signoff --gpg-sign"
alias tag="git tag --gpg-sign"
alias commit-nogpg="git commit --signoff --no-gpg-sign"
alias new-checkpoint="commit"
alias new-checkpoint-nogpg="commit-nogpg"
## shortcuts to creating tags
alias tag-checkpoint="git tag --gpg-sign"
alias tag-checkpoint-nogpg="git tag --no-gpg-sign"
alias new-tag="tag-checkpoint"
alias new-tag-nogpg="tag-checkpoint-nogpg"
## shortcuts to managing yiff stash
alias stash="git stash push --keep-index"
alias pop-stash="git stash pop"
alias apply-stash="git stash apply"
alias yeet-stash="git stash drop"
## staging stuff
alias stage="git add"
alias unstage="git rm --cached"
alias nuke-from-index="git rm"
# branch management
alias rename-branch="git branch -m"
alias set-upstream-remote="git branch -u"
# remote management
alias change-origin="git remote set-url origin"
alias change-upstream="git remote set-url upstream"
alias set-upstream-remote="git branch -u"
alias add-remote="git remote add"
alias change-remote-url="git remote set-url"
alias nuke-remote="git remote remove"
@ -26,3 +70,17 @@ alias fetch="git fetch --all"
## assumes its same branch.
alias pull-upstream="fetch && git pull upstream"
alias pull-origin="fetch && git pull origin"
# history-cleanup like scripts
alias clean-shellhis="history -c && clear"
# test SSH connections
alias test-gh-ssh="ssh -p 22 git@github.com"
alias test-gl-ssh="ssh -p 22 git@gitlab.com"
# ssh-agent stuff
## quock shortcut into add-ssh-keys stuff
alias add-ssh-key="$HOME/.dotfiles/bin/add-ssh-keys"
# shortcuts to some functions
alias edit-script="edit-script-file"

5
bashrc/chain-source Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
# these commands should be triggered on shell startup
source ~/.dotfiles/bashrc/aliases
source ~/.dotfiles/bashrc/worthwhile-functions

View File

@ -21,8 +21,8 @@ export DOTFILES_STUFF_BIN="$HOME/.dotfiles/bin"
export PATH=$PATH:$DOTFILES_STUFF_BIN
# clean up bash history
echo
history -c && echo "history-cleanup: Shell history cleaned for past session" || echo "history-cleanup: No bash_history file found for past session."
#echo
#rm -rf ~/.bash_history>>/dev/null && history -c && echo "history-cleanup: Shell history cleaned for past session" || echo "history-cleanup: No bash_history file found for past session."
# add my aliases
source ~/.dotfiles/bashrc/aliases
# then do chain sourcing
source ~/.dotfiles/bashrc/chain-source

View File

@ -0,0 +1,29 @@
#!/usr/bin/bash
# custom function management here
# changes to the worthwhile-functions filepath requires
# an update o the filepath via 'edit-script reload-funcs-bashrc
# and also any reference here
disable-funcs () {
echo "info: Unimplemented yet. Tell Andrei to add it to his todo."
}
edit-funcs-bashrc() {
$(echo $EDITOR || command -v nano>>/dev/null && echo nano || echo vi) ~/.dotfiles/bashrc/worthwhile-functions
}
list-debs-size () {
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -rn | less
}
edit-script-file () {
# if you use other editor, please set $EDITOR.
$(echo $EDITOR || command -v nano>>/dev/null && echo nano || echo vi) $(command -v $1)
}
# reloading stuff
refresh-funcs() {
$DOTFILES_STUFF_BIN/reload-funcs-bashrc
}
refresh-aliases() {
source $HOME/.dotfiles/bashrc/aliases
}

20
bin/history-cleanup Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
usage() {
echo "history-cleanup: Remove .*_history files from your home directory"
echo "Usage: $0 [COMMAND]"
echo "When used without any arguments, the script will assume 'all' was used."
echo
echo "WARNING: Since this script is written in Bash, there'll be no support"
echo "for other shells, considering the best-effort policy, from the"
echo "original script author"
echo "Available commands:"
echo "all Delete any history file found in home directory."
echo "bash Delete ~/.bash_history + run history -c"
echo "python"
exit
}
if [[ $@ == "" ]]; then
usage
fi

17
bin/reload-funcs-bashrc Executable file
View File

@ -0,0 +1,17 @@
#!/bin/env bash
echo "---> Refreshing custom functions..."
sleep 5
# change the path if it's different
source ~/.dotfiles/bashrc/worthwhile-functions
if [[ $? == 0 ]]; then
echo "info: Successfully refreshed functions to current session."
echo "info: Something don't work? Run edit-funcs-bashrc to edit"
echo "info: or even remove problematic functions"
else
echo "! Problems found, please run edit-funcs-bashrc to fix"
echo " and re-run this command again. In case of path changes,"
echo " please do 'source ~/.bashrc' if issue presists."
echo " If you ever moved that file, also update your ~/.bashrc and"
echo " the ~/.dotfiles/bin/reload-funcs-bashrc\#L5"
fi

View File

@ -1,5 +1,5 @@
# import ours first
include /data/data/com.termux/files/home/.dotfiles/nanorc/highlighting/*.nanorc
# then the package defaults
# import package defaults first
include /data/data/com.termux/files/usr/share/nano/*
# then import ours
include /data/data/com.termux/files/home/.dotfiles/nanorc/highlighting/*.nanorc