Skip to content

Instantly share code, notes, and snippets.

@manero6
manero6 / README.md
Last active November 22, 2023 18:52
testing links to headers and headers id
@manero6
manero6 / sideload-magisk.md
Created September 21, 2023 13:29
Step-by-step guide on how I install Magisk using adb
@manero6
manero6 / yt-dlp-mkdir.sh
Last active September 28, 2023 15:42
download with yt-dlp in a new directory that gets its name from the last part of the given URL
#!/bin/bash
ROOT_DIRECTORY=`basename "$(pwd)"`
ARGUMENTS_NR=$#
ARGUMENTS=$@
yt-dlp-mkdir () {
for i in $ARGUMENTS
do
declare -a DIRECTORY="(`basename $i | tr "-" " "`)"
@manero6
manero6 / clip-cleaner.sh
Last active October 19, 2023 09:17
simple script based on xclip to filter out stuff from the clipboard
#!/bin/bash
# put current clipboard in a variable
XCLIP_CLIPBOARD="$(xclip -o -selection clipboard)"
XCLIP_SELECTION=$XCLIP_CLIPBOARD
if [ $# -ge 1 ]
then
# print the initial string aka the current clipboard
echo "=> 1st string: $XCLIP_CLIPBOARD"
@manero6
manero6 / speedtest-loop.sh
Last active September 21, 2023 09:41
Speedtest-cli loop printing only download and upload rates
#!/bin/bash
for ((COUNTER=1; COUNTER>0; COUNTER++))
do
echo "$(date +%c) => Test nr: $COUNTER" && \
speedtest-cli 2>/dev/null | grep -E "^Download|^Upload"
done
@manero6
manero6 / zip2m3u
Last active October 18, 2022 07:09
Create .m3u playlist for multi-disc games (unzip .bin/.cue, create .chd files, create .m3u playlist)
#!/bin/bash
IFS=$'\n'
ARGUMENTS=$#
GAME_ZIP="$1"
GAME_NOZIP="${GAME_ZIP%.zip}"
GAME_NODISC="${GAME_NOZIP% *isc*}"
GAME_DIR=$GAME_NODISC
DISC=1
@manero6
manero6 / hours2seconds
Last active October 19, 2023 09:19
Simple bash script to calculate total seconds from hours, minutes and seconds
#!/bin/bash
HOU=0
MIN=0
SEC=0
if [[ $# -ge 4 ]]
then
echo "Please provide from 0 to a maximum of 3 arguments"
exit 1
@manero6
manero6 / ffmpeg-list4concat.sh
Last active September 28, 2023 15:53
Bash script to create a formatted list to be used when concatenating with FFmpeg
#!/bin/bash
if [ $# = 1 ]
then
LIST=`ls | grep -i "$1" | sed -e "s/^/file '/" -e "s/$/'/"`
if [[ -f list ]]
then
read -p "Do you want to overwrite the already existing 'list' file? (y/N) " yn
case $yn in
[yY]* ) echo -e "\nOverwriting already existing 'list' file with the following content:\n"
@manero6
manero6 / ffmpeg-bestcrop.py
Last active October 9, 2023 10:49
Run cropdetect and print 10 most detected crops
#!/usr/bin/env python3
import re
import sys
import subprocess
try:
file_to_crop = sys.argv[1]
except:
print("Please provide a video file.")
@manero6
manero6 / ffmpeg2x265.sh
Last active May 23, 2022 20:01
Re-encode videos to x265 with ffmpeg
if [ $# -ne 0 ]
then
for VIDEO in "$@"
do
VIDEO_NAME=$(echo "$VIDEO" | cut -d. -f1)
VIDEO_x265="$VIDEO_NAME".x265.mp4
ffmpeg -i "$VIDEO" -c:v libx265 "$VIDEO_x265" \
&& RESULT="$RESULT$(\
echo "Successfully converted -> $VIDEO_NAME" && \
echo " original: %2s $(ls -lh "$VIDEO" | cut -d' ' -f5)" && \