This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Usage: | |
# httpcat URL | |
if [ "$#" -lt 1 ]; then | |
echo "Usage: `basename $0` URL" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sleep_time="2" | |
large_location="$HOME/$RANDOM" | |
DIR="." | |
send_pdf() { find $DIR -type f -name "*.pdf" -exec telegram-send --file "{}" \; -exec sleep $sleep_time \; ; } | |
send_epub() { find $DIR -type f -name "*.epub" -exec telegram-send --file "{}" \; -exec sleep $sleep_time \; ; } | |
find_pdf() { find $DIR -type f -name "*.pdf" -exec ls "{}" \; ; } | |
find_epub() { find $DIR -type f -name "*.epub" -exec ls "{}" \; ; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
urlencode() { | |
# urlencode <string> | |
old_lc_collate=$LC_COLLATE | |
LC_COLLATE=C | |
local length="${#1}" | |
for (( i = 0; i < length; i++ )); do | |
local c="${1:$i:1}" | |
case $c in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
URL="${1}" | |
UserAgent="[HTTPSTATUS]:[https://git.io/JcTUF]" | |
if [ "$#" -lt 1 ]; then | |
echo "Usage: ./`basename $0` URL" | |
exit 1 | |
fi | |
function unknown_status() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# use find exec to remove multiple files: | |
# find path/to/dir -exec ./rmzero {} \; | |
if [ "$#" -lt 1 ]; then | |
echo "./`basename $0` <file>"; | |
exit 1; | |
fi | |
function load() { FILE="$(realpath $1)" ; MB_COUNT="$(du -m $FILE | awk '{print $1}')" ; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen X.X.X.X:53682; | |
gzip on; | |
server_tokens off; | |
access_log /tmp/rclone.access; | |
error_log /tmp/rclone.error; | |
location / { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd "$(dirname "${BASH_SOURCE[0]}")" | |
function execute() { | |
cd $i | |
echo -e "\e[91m$x:\e[0m\e[92m`pwd`\e[0m" | |
case $1 in | |
ls) $@ --color=auto ;; | |
grep) $@ --color=auto ;; | |
fgrep) $@ --color=auto ;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# CRONTAB: | |
# @daily /path/to/automysqlbackup.sh hour | |
# @daily /path/to/automysqlbackup.sh day | |
# @weekly /path/to/automysqlbackup.sh week | |
# @monthly /path/to/automysqlbackup.sh month | |
# MAIL: | |
# apt install mailutils postfix | |
[[ -t 1 ]] || set -x | |
SCRIPT=$(realpath $0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" -lt 2 ]; then | |
echo "./`basename $0` <count> <dir>"; | |
exit 1; | |
fi | |
for i in `seq 1 $1`; do | |
mktemp -d -t temp-XXXXXXXXXX --tmpdir=$2 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
case $1 in | |
0|--disable) cat /etc/hosts.local > /etc/hosts ;; | |
1|--enable) cat /etc/hosts.local > /etc/hosts ; cat /etc/hosts.d/* >> /etc/hosts ;; | |
esac |