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
sudo truncate -s 0 /swap.img | |
sudo chattr +C /swap.img | |
sudo fallocate -l 64G /swap.img | |
sudo chmod 0600 /swap.img | |
sudo mkswap /swap.img | |
sudo swapon /swap.img | |
sudo swapon --show |
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/sh -u | |
# Count all files | |
# ./count | |
# Count only mp3 files | |
# ./count "*.mp3" | |
# Count only directories | |
# ./count "" "d" | |
# Count only directories ending with blah | |
# ./count "*blah" "d" |
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 -ue | |
HELP="$0 [--i686|--i386|--x86_32|--x32] [--amd64|--x86_64|--x64] [--armv7l|--armv7|--arm|--armhf] [--arm64|--aarch64]" | |
I386=''; I686=''; X86_32=''; X32=''; BITS_32=''; | |
ONLY_686=''; ONLY_386=''; ONLY_32=''; ONLY_64=''; | |
AMD64=''; X86_64=''; X64=''; BIT_64=''; | |
AARCH64=''; ARM64=''; | |
ARM_V6=''; ARMV7L=''; ARMV7=''; ARM=''; ARM_HF=''; | |
while [ $# -gt 0 ]; do | |
case "${1-}" in | |
'--32bit'|'-32bit') BIT_64='yes'; ONLY_32=''; I686=''; X32=''; ONLY_386=''; ONLY_686=''; I386=''; X86_32='';; |
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
# 1. Replace any non valid characters with dash | |
# 2. Remove any .- from start of name | |
# 3. Replace duplicate dash with a single one | |
# 3. Replace duplicate underscore with a single one | |
# 4. Replace duplicate dot with a single one | |
# 5. Truncate string to 128 chars (or less) | |
sed -e 's/[^[:alnum:]\.\_\-]/-/g' \ | |
-e 's|^[.-]\+||g' \ | |
-e 's|-\+|-|g' \ | |
-e 's|_\+|_|g' \ |
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
curl -s http://mirrors.ubuntu.com/mirrors.txt | xargs -n1 -I {} sh -c 'echo `curl -r 0-102400 -s -w %{speed_download} -o /dev/null {}/ls-lR.gz` {}' | sort -g -r | head -1 | awk '{ print $2 }' |
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
# Use CI_COMMIT_TAG if it exists, otherwise lookup for a pkgversion file | |
PKGVERSION="$CI_COMMIT_TAG:-"$(head -n1 "$CI_PROJECT_DIR/pkgversion" 2>/dev/null)"}" | |
if [ -z "$PKGVERSION" ]; then | |
cd "${CI_PROJECT_DIR:-"."}" | |
# Check if we can find a tag otherwise specifically fetch tags | |
git describe --tags >/dev/null 2>&1 || git fetch --tags | |
# Set our package version correctly | |
PKGVERSION="$(git describe --tags 2>/dev/null)" | |
# If our package version couldn't be set this way then use Gitlab CI | |
if [ -z "$PKGVERSION" -a -n "$CI_COMMIT_SHORT_SHA" -a -n "$CI_PIPELINE_IID" -a -n "$CI_JOB_TOKEN" ]; then |
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 -ue | |
## | |
# Simple shell script to convert decimal to hex | |
# Created by hongkongkiwi: https://gist.github.com/hongkongkiwi/02d8bcde0c810f8dff6b6a96d11ce6bd | |
# Usage: | |
# ./dec_hex "12356" | |
# ./dec_hex -n "12356" | |
# ./dec_hex -n -l "12356" | |
# ./dec_hex -n -l -o "12356" | |
## |
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 | |
ACTION="$1" | |
# RClone Service Series | |
RCLONE="/bin/rclone" | |
CONFIG_FILE="/volume1/@rclone/config/rclone.conf" | |
MOUNT_NAME="${2:-"union_series"}" | |
MOUNT_POINT="${3:-"/volume1/media/series"}" | |
MOUNT_CACHE_DIR="/volume1/@tmp/@${MOUNT_NAME}" |
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/sh | |
BIN="$1"; shift | |
[ -z "$BIN" ] && { echo >&2 "ERROR: no app passed"; exit 1; } | |
APP_NAME=$(basename "$BIN") | |
PID_FILE=${PID_FILE:-"/var/run/${APP_NAME}.pid"} | |
function killapp() { [ -n "$APP_PID" ] && kill -s TERM $APP_PID 2>/dev/null >/dev/nulll; } | |
trap killapp INT TERM SIGTERM EXIT | |
rm -f "$PID_FILE" 2>/dev/null | |
APP_DIR=$(dirname "$BIN") | |
CUR_DIR="$PWD" |
NewerOlder