added secrets
This commit is contained in:
		@@ -1,16 +1,18 @@
 | 
			
		||||
{lib,stdenv,fetchFromGitHub}:
 | 
			
		||||
{lib, stdenv, fetchFromGitHub, rage, curl, sox, ffmpeg}:
 | 
			
		||||
stdenv.mkDerivation rec{
 | 
			
		||||
  name = "customscripts";
 | 
			
		||||
  src = fetchFromGitHub {
 | 
			
		||||
  src = ./src;
 | 
			
		||||
 /* src = fetchFromGitHub {
 | 
			
		||||
    owner = "idcretard";
 | 
			
		||||
    repo = "custom-scripts";
 | 
			
		||||
    rev = "a996a52831316cc2c282904352654bd20c82f7bd";
 | 
			
		||||
    sha256 = "sha256-nw21YmcmQMF8NADnuHOc7eF2Yaj/r/1mYBn77fYK7s8=";
 | 
			
		||||
  };
 | 
			
		||||
  };*/
 | 
			
		||||
  buildInputs = [ rage curl sox ffmpeg ];
 | 
			
		||||
  unpackPhase = ":";
 | 
			
		||||
  installPhase = ''
 | 
			
		||||
    mkdir -p $out/bin
 | 
			
		||||
    cp -r $src/* $out/bin
 | 
			
		||||
    for x in $out/bin/*;do chmod +x "$x";done
 | 
			
		||||
    for x in $out/bin/*; do chmod +x "$x"; done
 | 
			
		||||
'';
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								overlays/customscripts/src/agecrypt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								overlays/customscripts/src/agecrypt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
if [ $# -eq 0 ]; then echo "bruh"; exit 1; fi
 | 
			
		||||
FILE=$1
 | 
			
		||||
if [ $# -eq 2 ]; then
 | 
			
		||||
    TARGET="$2.age"
 | 
			
		||||
elif [ $# -eq 1 ]; then
 | 
			
		||||
    TARGET="$FILE.age"
 | 
			
		||||
else
 | 
			
		||||
    echo "bruh"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
rage -o "$TARGET" -r "$(cat ~/.ssh/*.pub)" "$1"
 | 
			
		||||
							
								
								
									
										2
									
								
								overlays/customscripts/src/batspec
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								overlays/customscripts/src/batspec
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
mkdir spectrals; cd spectrals; for x in ../*$1;do sox "$x" -n spectrogram -o "$(echo $(ffprobe -loglevel error -show_entries format_tags=track -of default=noprint_wrappers=1:nokey=1 "$x") - $(ffprobe -loglevel error -show_entries format_tags=TITLE -of default=noprint_wrappers=1:nokey=1 "$x")).png"; done
 | 
			
		||||
							
								
								
									
										14
									
								
								overlays/customscripts/src/batspecup
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								overlays/customscripts/src/batspecup
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
mkdir spectrals
 | 
			
		||||
cd spectrals
 | 
			
		||||
for x in ../*$1
 | 
			
		||||
do
 | 
			
		||||
	spec="$(echo $(ffprobe -loglevel error -show_entries format_tags=track -of default=noprint_wrappers=1:nokey=1 "$x") - $(ffprobe -loglevel error -show_entries format_tags=TITLE -of default=noprint_wrappers=1:nokey=1 "$x"))"
 | 
			
		||||
	sox "$x" -n spectrogram -o "$spec.png" -t "$spec"
 | 
			
		||||
	resp=$(curl -F file-upload=@"$spec.png" -F "api_key=$PTPIMGAPI" https://ptpimg.me/upload.php 2>/dev/null)
 | 
			
		||||
	echo "$spec"
 | 
			
		||||
	echo [img]https://ptpimg.me/$(echo $resp | jq -r .[0].code).$(echo $resp | jq -r .[0].ext)[/img]
 | 
			
		||||
	rm "$spec.png"
 | 
			
		||||
done
 | 
			
		||||
cd ..
 | 
			
		||||
rm -r spectrals
 | 
			
		||||
							
								
								
									
										15
									
								
								overlays/customscripts/src/battrans
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								overlays/customscripts/src/battrans
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
IFS=$'\n'
 | 
			
		||||
for i in $(ls *$3)
 | 
			
		||||
do
 | 
			
		||||
    if [ $1 = "320" ]; then
 | 
			
		||||
	    ffmpeg -i "$i" -codec:a libmp3lame -b:a 320k -map_metadata 0 -id3v2_version 3 "$2/${i%.$3}".mp3
 | 
			
		||||
    elif [ $1 = "v0" ]; then
 | 
			
		||||
	    ffmpeg -i "$i" -codec:a libmp3lame -q:a 0 -map_metadata 0 -id3v2_version 3 "$2/${i%.$3}".mp3
 | 
			
		||||
    elif [ $1 = "alactoflac" ]; then
 | 
			
		||||
	    ffmpeg -i "$i" -codec:a flac -map_metadata 0 -id3v2_version 3 "$2/${i%.$3}".flac
 | 
			
		||||
    else
 | 
			
		||||
	    sox "$i" -G -b 16 "$2/${i%.$3}".flac rate -v -L 48000 dither
 | 
			
		||||
    fi
 | 
			
		||||
    echo $i
 | 
			
		||||
done
 | 
			
		||||
							
								
								
									
										9
									
								
								overlays/customscripts/src/compmusic
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								overlays/customscripts/src/compmusic
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
if [ $1 == "flac" ]; then
 | 
			
		||||
  for x in *.flac; do
 | 
			
		||||
    flac "$x" --compression-level-8 -o "bruh.$x"
 | 
			
		||||
    mv "bruh.$x" "$x"
 | 
			
		||||
  done
 | 
			
		||||
else
 | 
			
		||||
  echo "bruh"
 | 
			
		||||
fi
 | 
			
		||||
							
								
								
									
										32
									
								
								overlays/customscripts/src/compress
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								overlays/customscripts/src/compress
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
target_video_size_KB="$2"
 | 
			
		||||
origin_duration_s=$(ffprobe -v error -show_streams -select_streams a "$1" | grep -Po "(?<=^duration\=)\d*\.\d*")
 | 
			
		||||
echo $origin_duration_s
 | 
			
		||||
origin_audio_bitrate_kbit_s=$(ffprobe -v error -pretty -show_streams -select_streams a "$1" | grep -Po "(?<=^bit_rate\=)\d*\.\d*")
 | 
			
		||||
target_audio_bitrate_kbit_s=$origin_audio_bitrate_kbit_s
 | 
			
		||||
target_video_bitrate_kbit_s=$(\
 | 
			
		||||
    awk \
 | 
			
		||||
    -v size="$target_video_size_KB" \
 | 
			
		||||
    -v duration="$origin_duration_s" \
 | 
			
		||||
    -v audio_rate="$target_audio_bitrate_kbit_s" \
 | 
			
		||||
    'BEGIN { print  ( ( size * 8.0 ) / ( 1.048576 * duration ) - audio_rate ) }')
 | 
			
		||||
 | 
			
		||||
ffmpeg \
 | 
			
		||||
    -y \
 | 
			
		||||
    -i "$1" \
 | 
			
		||||
    -c:v libx264 \
 | 
			
		||||
    -b:v "$target_video_bitrate_kbit_s"k \
 | 
			
		||||
    -pass 1 \
 | 
			
		||||
    -an \
 | 
			
		||||
    -f mp4 \
 | 
			
		||||
    /dev/null \
 | 
			
		||||
&& \
 | 
			
		||||
ffmpeg \
 | 
			
		||||
    -i "$1" \
 | 
			
		||||
    -c:v libx264 \
 | 
			
		||||
    -b:v "$target_video_bitrate_kbit_s"k \
 | 
			
		||||
    -pass 2 \
 | 
			
		||||
    -c:a aac \
 | 
			
		||||
    -b:a "$target_audio_bitrate_kbit_s"k \
 | 
			
		||||
    "$3"
 | 
			
		||||
							
								
								
									
										13
									
								
								overlays/customscripts/src/fan
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								overlays/customscripts/src/fan
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
#Script to control fans via nbfc in /opt/nbfc
 | 
			
		||||
if [[ $1 = "a" ]]; then
 | 
			
		||||
	mono /opt/nbfc/nbfc.exe set -f 0 -a
 | 
			
		||||
else
 | 
			
		||||
	mono /opt/nbfc/nbfc.exe set -f 0 -s $1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [[ $2 = "a" ]]; then
 | 
			
		||||
	mono /opt/nbfc/nbfc.exe set -f 1 -a
 | 
			
		||||
else
 | 
			
		||||
	mono /opt/nbfc/nbfc.exe set -f 1 -s $2
 | 
			
		||||
fi
 | 
			
		||||
							
								
								
									
										4
									
								
								overlays/customscripts/src/killmpd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								overlays/customscripts/src/killmpd
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
killall mpd
 | 
			
		||||
killall mpd_discord_richpresence
 | 
			
		||||
killall mpdas
 | 
			
		||||
							
								
								
									
										3
									
								
								overlays/customscripts/src/listalbum
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								overlays/customscripts/src/listalbum
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
for x in *$1;do echo $(ffprobe -loglevel error -show_entries format_tags=track -of default=noprint_wrappers=1:nokey=1 "$x") - $(ffprobe -loglevel error -show_entries format_tags=TITLE -of default=noprint_wrappers=1:nokey=1 "$x"); done
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										4
									
								
								overlays/customscripts/src/mpdp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								overlays/customscripts/src/mpdp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
mpd
 | 
			
		||||
mpdas &
 | 
			
		||||
mpd_discord_richpresence &
 | 
			
		||||
							
								
								
									
										5
									
								
								overlays/customscripts/src/x0
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								overlays/customscripts/src/x0
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
for x in $@; do
 | 
			
		||||
  curl -F "file=@\"$x\"" https://x0.at/
 | 
			
		||||
  echo " "
 | 
			
		||||
done
 | 
			
		||||
							
								
								
									
										7
									
								
								overlays/customscripts/src/ytmp3
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								overlays/customscripts/src/ytmp3
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
youtube-dl -f bestaudio -o "ytmp3.%(title)s.%(ext)s" "$1"
 | 
			
		||||
file=$(echo ytmp3.*.*)
 | 
			
		||||
newfile=$(echo $file | cut -c 7-)
 | 
			
		||||
mv "$file" "$newfile"
 | 
			
		||||
ffmpeg -i "$newfile" -c:a mp3 "${newfile%.*}.mp3"
 | 
			
		||||
rm "$newfile"
 | 
			
		||||
@@ -14,8 +14,8 @@ final: prev: {
 | 
			
		||||
    src = prev.fetchFromGitHub {
 | 
			
		||||
      owner = "natto1784";
 | 
			
		||||
      repo = "dwm";
 | 
			
		||||
      rev = "cd69bb00b0ecd941cdb5d048df029f3b762eea8c";
 | 
			
		||||
      sha256 = "sha256-dZyF7GnVJZzzAy8DO2pqCoIj7t1vZLdfhHm1cJKXah0=";
 | 
			
		||||
      rev = "a3896f13d20218ce07a7b646459cd5ce6ed2f27d";
 | 
			
		||||
      sha256 = "sha256-iyUFeZwqZ6veMs+3lBcpBLENN4r27QlkARfAL3OJvks=";
 | 
			
		||||
    };
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
@@ -25,7 +25,7 @@ final: prev: {
 | 
			
		||||
      repo = "st";
 | 
			
		||||
      rev = "0cd1e394e6d07c5f605ae23070c40de9690bafb1";
 | 
			
		||||
      sha256 = "sha256-EY5Amz16Drc4i0uEAYTPEHcGex0s3pzHDqfDp4Z5OGY=";
 | 
			
		||||
    };
 | 
			
		||||
    }; 
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  kbd = prev.kbd.overrideAttrs (oldAttrs: rec{
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user