update
This commit is contained in:
parent
3516e8686b
commit
6a68a69d87
|
@ -0,0 +1,4 @@
|
|||
|
||||
\.vscode/
|
||||
|
||||
\.history/
|
125
mybashrc
125
mybashrc
|
@ -1,18 +1,18 @@
|
|||
transfer() {
|
||||
curl --progress-bar --upload-file $1 https://transfer.vtbox.net/$(basename $1) | tee /dev/null;
|
||||
transfer_vtbox_net() {
|
||||
curl --progress-bar --upload-file $1 https://transfer.vtbox.net/$(basename $1) | tee /dev/null
|
||||
}
|
||||
alias transfer=transfer
|
||||
alias transfer=transfer_vtbox_net
|
||||
alias cheat='cht.sh'
|
||||
alias pull='git pull origin master'
|
||||
|
||||
git_commit() {
|
||||
git add .
|
||||
git commit -m "autocommit on $date"
|
||||
git add .
|
||||
git commit -m "autocommit on $date"
|
||||
}
|
||||
|
||||
git_push() {
|
||||
git fetch
|
||||
git push
|
||||
git fetch
|
||||
git push
|
||||
}
|
||||
|
||||
alias commit=git_commit
|
||||
|
@ -22,9 +22,116 @@ alias lh="stat -c '%A %a %n'"
|
|||
alias wp='wp --allow-root'
|
||||
alias ll='ls -alhF'
|
||||
|
||||
mynginxconf(){
|
||||
mynginxconf() {
|
||||
|
||||
nano /etc/nginx/sites-available/$1
|
||||
nano /etc/nginx/sites-available/$1
|
||||
|
||||
}
|
||||
alias nginxconf=mynginxconf
|
||||
|
||||
MAINTENANCE_APT() {
|
||||
echo "###############################"
|
||||
echo "APT UPDATE"
|
||||
echo "###############################"
|
||||
## Updates package lists
|
||||
sudo apt update
|
||||
echo
|
||||
echo "###############################"
|
||||
echo "APT FULL-UPGRADE"
|
||||
echo "###############################"
|
||||
## Updates packages and libraries
|
||||
sudo apt full-upgrade -y
|
||||
echo "###############################"
|
||||
echo "APT AUTOREMOVE"
|
||||
echo "###############################"
|
||||
## Removes unneeded packages
|
||||
sudo apt-get -y --purge autoremove # Debian Jessie uses old apt. So
|
||||
echo "###############################"
|
||||
echo "KERNEL CLEANUP"
|
||||
echo "###############################"
|
||||
|
||||
# purge-old-kernels - remove old kernel packages
|
||||
# Copyright (C) 2012 Dustin Kirkland <kirkland -(at)- ubuntu.com>
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland-(at)-ubuntu.com>
|
||||
# Kees Cook <kees-(at)-ubuntu.com>
|
||||
#
|
||||
# NOTE: This script will ALWAYS keep the currently running kernel
|
||||
# NOTE: Default is to keep 2 more, user overrides with --keep N
|
||||
KEEP=2
|
||||
# NOTE: Any unrecognized option will be passed straight through to apt
|
||||
APT_OPTS=
|
||||
while [ ! -z "$1" ]; do
|
||||
case "$1" in
|
||||
--keep)
|
||||
# User specified the number of kernels to keep
|
||||
KEEP="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
APT_OPTS="$APT_OPTS $1"
|
||||
shift 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Build our list of kernel packages to purge
|
||||
CANDIDATES=$(ls -tr /boot/vmlinuz-* | head -n -${KEEP} | grep -v "$(uname -r)$" | cut -d- -f2- | awk '{print "linux-image-" $0 " linux-headers-" $0}')
|
||||
for c in $CANDIDATES; do
|
||||
dpkg-query -s "$c" >/dev/null 2>&1 && PURGE="$PURGE $c"
|
||||
done
|
||||
|
||||
if [ -z "$PURGE" ]; then
|
||||
echo "No kernels are eligible for removal"
|
||||
fi
|
||||
|
||||
sudo apt $APT_OPTS remove -y --purge $PURGE
|
||||
|
||||
echo "###############################"
|
||||
echo "DEBORPHAN"
|
||||
echo "###############################"
|
||||
## Removes unused config files
|
||||
sudo deborphan -n --find-config | xargs sudo apt-get -y --purge autoremove
|
||||
|
||||
echo "###############################"
|
||||
echo "APT AUTOCLEAN"
|
||||
echo "###############################"
|
||||
## Removes package files that can no longer be downloaded and everything except
|
||||
# the lock file in /var/cache/apt/archives, including directories.
|
||||
sudo apt-get -y autoclean
|
||||
sudo apt-get -y clean
|
||||
|
||||
echo "###############################"
|
||||
echo "DEINSTALLED PACKAGES CLEANUP"
|
||||
echo "###############################"
|
||||
## clean packages in deinstall state
|
||||
DEINSTALLED=$(sudo dpkg --get-selections | grep deinstall | cut -f1)
|
||||
if [ ! -z "$DEINSTALLED" ]; then
|
||||
sudo dpkg --get-selections | grep deinstall | cut -f1 | xargs dpkg --purge
|
||||
else
|
||||
echo "No packages are eligible for removal"
|
||||
fi
|
||||
|
||||
if [ -x /usr/bin/docker ]; then
|
||||
echo "###############################"
|
||||
echo "DOCKER CLEANUP"
|
||||
echo "###############################"
|
||||
docker volume rm $(docker volume ls -f dangling=true -q)
|
||||
list_images=$(docker images --filter "dangling=true" -q --no-trunc)
|
||||
list_volumes=$(docker volume ls -qf dangling=true)
|
||||
if [ ! -z "$list_images" ]; then
|
||||
docker rmi $list_images
|
||||
fi
|
||||
if [ ! -z $list_volumes ]; then
|
||||
docker volume rm $list_volumes
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
alias maintenance=MAINTENANCE_APT
|
||||
|
||||
wp_scan_website() {
|
||||
docker run -it --rm wpscanteam/wpscan -u https://$1
|
||||
}
|
||||
alias wpscan=wp_scan_website
|
Loading…
Reference in New Issue