commit 49437aa167bc4b8d1ba1157204113d1e128df408 Author: Kryštof Pešek Date: Fri Aug 30 09:44:33 2024 +0200 Merge from X250 diff --git a/Google.sh b/Google.sh new file mode 100755 index 0000000..880db01 --- /dev/null +++ b/Google.sh @@ -0,0 +1,6 @@ +#!/bin/sh +a='google.com/search?q=' +c=$a$1 +echo searching! +echo $c +elinks -dump --no-numbering --no-references $c | sed -n '/[0-9]\./,+2p' diff --git a/PerlinNet b/PerlinNet new file mode 120000 index 0000000..f6975d1 --- /dev/null +++ b/PerlinNet @@ -0,0 +1 @@ +/home/kof/src/PerlinNet/PerlinNet \ No newline at end of file diff --git a/SimpleSend b/SimpleSend new file mode 100755 index 0000000..87da6dd Binary files /dev/null and b/SimpleSend differ diff --git a/SuddenStrike b/SuddenStrike new file mode 100755 index 0000000..e3e30b9 --- /dev/null +++ b/SuddenStrike @@ -0,0 +1,3 @@ +#!/bin/sh +cd ~/.wine/drive_c/Program\ Files\ \(x86\)/GameTop.com/Sudden\ Strike\ 2/Run/ +wine game_exe.exe diff --git a/Updater b/Updater new file mode 100755 index 0000000..f5ab48d Binary files /dev/null and b/Updater differ diff --git a/bang b/bang new file mode 100755 index 0000000..c9e5eba --- /dev/null +++ b/bang @@ -0,0 +1,2 @@ +#!/bin/bash +echo 1 > /tmp/signal diff --git a/baudline_jack b/baudline_jack new file mode 100755 index 0000000..ec36dd3 Binary files /dev/null and b/baudline_jack differ diff --git a/beep b/beep new file mode 100755 index 0000000..19195b8 Binary files /dev/null and b/beep differ diff --git a/byteBeatRenderer b/byteBeatRenderer new file mode 100755 index 0000000..c4131db --- /dev/null +++ b/byteBeatRenderer @@ -0,0 +1 @@ +echo "main(t){for(t=0;;t++)putchar(((t*t+t)>>t/5000)|t*t);}" | gcc -x c - -lm -o /tmp/bytebeat && /tmp/bytebeat | ffmpeg -f rawvideo -pix_fmt gray -s 64x36 -i - -f s16le -ar 8000 -ac 2 -i - -vf "[in]fade=in:0:50[a],[a]fade=out:3300:300[b],[b]scale=1280:720[out]" -af "[in]afade=t=in:ss=0:d=2[a],[a]afade=t=out:st=110:d=10[out]" -c:v libx264 -b:v 6M -r 30 -c:a aac -strict -2 -ar 44100 -b:a 128k -t 120 -y ~/render/byteBeat.mp4 diff --git a/click b/click new file mode 100755 index 0000000..e589290 --- /dev/null +++ b/click @@ -0,0 +1,2 @@ +#!/bin/bash +xdotool click 1 diff --git a/datum b/datum new file mode 100755 index 0000000..0face07 --- /dev/null +++ b/datum @@ -0,0 +1,2 @@ +#!/bin/sh +date +%s_%Y_%m_%d_W%V_kof%y.scd diff --git a/decimaltime b/decimaltime new file mode 100755 index 0000000..1b37909 --- /dev/null +++ b/decimaltime @@ -0,0 +1,2 @@ +#!/bin/bash +echo `date +%H:%M:%S:0.%N | awk -F "[d :]" '{printf "%.10f", (($1*3600)+($2*60)+($3)+($4))/86400.0 }'` diff --git a/deczech b/deczech new file mode 100755 index 0000000..f87f2a2 --- /dev/null +++ b/deczech @@ -0,0 +1,3 @@ +#!/bin/bash +echo "$*" | tr '[:lower:]' '[:upper:]' | awk -F ',' '{print $1","$2}' | tr ' ' '_' | recode -f utf8..flat | tr ',' ' ' | awk '{print $1" "$2}' | tr '[:lower:]' '[:upper:]' +#echo "$*" | tr '[:lower:]' '[:upper:]' | tr '[:upper:]' '[:lower:]' | tr 'ě' 'e' | tr 'š' 's' | tr 'č' 'c' | tr 'ř' 'r' | tr 'ž' 'z' | tr 'ý' 'y' | tr 'á' 'a' | tr 'í' 'i' | tr 'é' 'i' | tr 'ú' 'u' | tr 'ů' 'u' | tr ' ' '_' | tr '[:lower:]' '[:upper:]' diff --git a/dither b/dither new file mode 100755 index 0000000..c8be9b6 Binary files /dev/null and b/dither differ diff --git a/fakeCam b/fakeCam new file mode 100755 index 0000000..7963499 --- /dev/null +++ b/fakeCam @@ -0,0 +1,2 @@ +#!/bin/bash +sudo modprobe v4l2loopback && ffmpeg -f x11grab -r 30 -s 1024x768 -i :0.0+1600,0 -vcodec rawvideo -pix_fmt yuv420p -threads 1 -f v4l2 /dev/video1 diff --git a/fragmentFast b/fragmentFast new file mode 100755 index 0000000..a30ffe2 --- /dev/null +++ b/fragmentFast @@ -0,0 +1,10 @@ +#!/bin/bash +Start=`frac "$2" "$4"` #`echo "$2" | sed 's/.\{2\}/&:/g' | head -c 8` +End=`frac "$3" "$4"` #`echo "$3" | sed 's/.\{2\}/&:/g' | head -c 8` +IN="$2" #`echo "$2" | sed 's/.\{2\}/&:/g' | head -c 8` +OUT="$3" #`echo "$3" | sed 's/.\{2\}/&:/g' | head -c 8` + +#Len=`date -u -d "0 $Duration sec - $Start sec" +"%H:%M:%S"` +Len=`echo "$(date -u -d@"$(( ($(date -u -d"$End" +%s%N) - $(date -u -d"$Start" +%s%N))/1000000000 ))" +%H:%M:%S)"."$(( ($(date -u -d"$End" +%s%N) - $(date -u -d"$Start" +%s%N))%1000000000/1000000 ))"` +echo getting $Len of "$1" +ffmpeg -ss "$Start" -i "$1" -t "$Len" -c:v copy -c:a copy "`basename -s .mov $1`"_`echo $IN | tr ':' '-'`_`echo $OUT | tr ':' '-'`_FRAGMENT.mov diff --git a/gensign b/gensign new file mode 100755 index 0000000..8b4476d --- /dev/null +++ b/gensign @@ -0,0 +1,8 @@ +#!/bin/bash +echo "Kryštof Pešek" > /home/kof/.signature +echo "https://k0f.github.io" >> /home/kof/.signature +echo "https://k-o-l-e-k-t-i-v.github.io" >> /home/kof/.signature +echo "----------------------------------------------------" >> /home/kof/.signature +echo Unix epoch : `date +%s` >> /home/kof/.signature +echo Metric time: `/home/kof/bin/metriclock` >> /home/kof/.signature +echo Moon phase : `/home/kof/bin/moonphase` >> /home/kof/.signature diff --git a/getTime.sh b/getTime.sh new file mode 100755 index 0000000..3621443 --- /dev/null +++ b/getTime.sh @@ -0,0 +1,2 @@ +#!/bin/bash +stat "$1" 2>/dev/null | grep Modify | awk '{print $2}' diff --git a/h264Parallel.sh b/h264Parallel.sh new file mode 100755 index 0000000..a19eac0 --- /dev/null +++ b/h264Parallel.sh @@ -0,0 +1,54 @@ +#!/bin/bash +INPUT="$1" +DURATION=$(ffprobe -v error -select_streams v:0 -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 "$INPUT"); +SECS=$(echo $DURATION | awk -F'.' '{print $1}') +FRAG=$(echo $DURATION | awk -F'.' '{print $2}') +NO_OF_SEGMENTS=$(($SECS/60)) +echo total duration "$SECS.$FRAG"s +echo number of segments $NO_OF_SEGMENTS +REST=$(( $SECS % 60 )).$FRAG +MINS=0 +HOS=0 + + +rm -rf /mnt/central/TEMP_KRYSTOF/parallel/* +echo "" > /tmp/jobs +echo "" > /tmp/files + +SCOUNT=0 +LOOP_NO=0 + +while [[ $SCOUNT -le $SECS ]]; +do + TIME=`printf "%02d" $HOS`:`printf "%02d" $MINS`:00 + + SEGMENT=60 + if [ $LOOP_NO -eq $NO_OF_SEGMENTS ] + then + SEGMENT=$REST + fi + + #echo $TIME $SEGMENT + + OUTPUT=/tmp/$(echo `basename $INPUT` | awk -F'.' '{print $1}')_$TIME.mp4 + + echo "ffmpeg -loglevel panic -ss $TIME -i $INPUT -t $SEGMENT -c:v h264 -pix_fmt yuv420p -crf 22 -preset ultrafast -threads 1 -c:a aac -y $OUTPUT" >> /tmp/jobs + echo file $OUTPUT >> /tmp/files + + SCOUNT=$(( SCOUNT + 60 )) + MINS=$(( $MINS + 1 )) + + if [ $MINS -ge 59 ] + then + MINS=0 + HOS=$(( $HOS + 1 )) + fi + LOOP_NO=$(( $LOOP_NO + 1 )) +done + +#parallel --eta --progress -S "32/nfaRender,32/nfaDTL01,8/:,8/nfaProjekce,8/nfaAdela" < /tmp/jobs +#parallel --eta --progress -S "8/nfaRender,8/nfaDTL01,4/nfaAdela,8/:,8/nfaProjekce" < /tmp/jobs +#parallel --eta --progress -S "4/nfaRender,4/nfaAdela,4/:,16/nfaProjekce" < /tmp/jobs +parallel --eta --progress -S "4/:" < /tmp/jobs +FIN="$(echo `basename $INPUT` | awk -F'.' '{print $1}')".mp4 +ffmpeg -f concat -safe 0 -i /tmp/files -c:v copy -c:a copy -y $FIN diff --git a/hammerfight b/hammerfight new file mode 100755 index 0000000..090580c --- /dev/null +++ b/hammerfight @@ -0,0 +1,2 @@ +#!/bin/sh +cd /opt/hammerfight/ && optirun ./Hammerfight diff --git a/icecast.sh b/icecast.sh new file mode 100755 index 0000000..9c6c432 --- /dev/null +++ b/icecast.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +#sudo dvgrab -format dv1 - | \ +# ffmpeg2theora -a 0 -v 5 -f dv -x 320 -y 240 -o /dev/stdout - | \ +# oggfwd -p -n "FAMU stream" localhost 8000 cigareta /theora.ogg + +ffmpeg -re -f video4linux2 -i /dev/video0 -r 30 -f jack -ac 2 -i stream -vcodec libtheora -b:v 1280k -s 640x360 -acodec libvorbis -b:a 128k -threads 4 -f ogg - | oggfwd -p -n "Kof's stream" localhost 8000 cigareta /test.ogg + +#ffmpeg -re -f video4linux2 -i /dev/video0 -r 15 -f jack -ac 2 -i test -vcodec libvpx -b:v 256k -s 480x270 -acodec libvorbis -b:a 128k -threads 4 -f webm http://localhost:8000/test + + +#ffmpeg -s 1280x720 -f video4linux2 -i /dev/video0 -f alsa -ac 2 -i hw:0,0 -b:a 128k -acodec libvorbis -vcodec libtheora -b:v 1000k -r 25 -threads 4 -f ogg - | oggfwd localhost 8000 cigareta /test.ogv +#dvgrab -format dv1 - | ffmpeg -s 800x600 -f dv -i - -b:a 128k -acodec libvorbis -vcodec libtheora -b:v 3M -r 25 -threads 4 -f ogg - | oggfwd -p -n "Hello world!" localhost 8000 cigareta /test.ogv +#dvgrab -format dv1 - | ffmpeg -f dv -i /dev/stdin -vcodec libtheora -r 25 -b:v 256k -s 480x270 -vf "yadif" -acodec libvorbis -b:a 128k -threads 4 -f ogg - | oggfwd -p -n "Informace" stream.iim.cz 8000 pass1234 /proud.ogv diff --git a/icelocal.sh b/icelocal.sh new file mode 100755 index 0000000..43f7e6e --- /dev/null +++ b/icelocal.sh @@ -0,0 +1,2 @@ +#!/bin/bash +melt "$@" -consumer avformat real_time=1 terminate_on_pause=0 f=ogg vcodec=libtheora b=1500k s=640x360 acodec=libvorbis aq=20 | icefwd -n "Live Stream" -d "irc.freenode.net #kolektiv" -f ogg localhost 8000 cigareta /live.ogg diff --git a/icemeltFast.sh b/icemeltFast.sh new file mode 100755 index 0000000..bbefa1f --- /dev/null +++ b/icemeltFast.sh @@ -0,0 +1,3 @@ +#!/bin/bash +#melt "$@" -consumer avformat real_time=1 terminate_on_pause=0 f=webm vcodec=libvpx b=1500k cpu-used=4 s=640x360 threads=4 acodec=libvorbis aq=20 | icefwd -n "Live Stream" -d "irc.freenode.net #kolektiv" -f webm localhost 8000 cigareta /live.mkv +melt "$@" -consumer avformat real_time=1 terminate_on_pause=0 s=1024x576 f=webm vcodec=libvpx b=5000k cpu-used=4 threads=4 acodec=libaac movflags="faststart" aq=20 | icefwd -n "Live Stream" -d "irc.freenode.net #kolektiv" -f webm localhost 8000 cigareta /live.mkv diff --git a/icescreenmelt.sh b/icescreenmelt.sh new file mode 100755 index 0000000..eac5ad4 --- /dev/null +++ b/icescreenmelt.sh @@ -0,0 +1,2 @@ +#!/bin/bash + melt ~/screen.mlt -consumer avformat real_time=1 terminate_on_pause=0 f=webm vcodec=libvpx b=2M cpu-used=4 s=1600x900 acodec=libvorbis threads=4 aq=20 | icefwd -n "Live Stream" -d "irc.freenode.net #kolektiv" -f webm localhost 8000 cigareta /live.webm diff --git a/kombinatorika b/kombinatorika new file mode 100755 index 0000000..b988b6d --- /dev/null +++ b/kombinatorika @@ -0,0 +1,2 @@ +#!/bin/bash +echo {multi,foto,nara,kombi,uni,nano,narko,neuro,kontra,filo,orto,auto,moto,elektro,atomo,algo,meteo,hyper,inter,fiber,opto,tele,gramo,mega,mikro,fono,proxy,para,pro,re,kyber,metro,techno,psycho}{aparát,text,versum,punkt,sugesce,dukt,pozice,pedie,neuron,net,fon,gram,graf,vize,pank,polis,logie,grafie,laxa,fráze,dox,sex,aktivita,procesor,signum,vitum,ton,tron,sofie,fil,mánie,fílie,fóbie,natorika,link,prostor,film,iluze,pohyb,drom,dron,heking,bending}. | sed -e 's/\./\n/g' | sort -R | espeak -vcs -s 120 -p 20 diff --git a/loudnorm b/loudnorm new file mode 100755 index 0000000..f6684e4 --- /dev/null +++ b/loudnorm @@ -0,0 +1,2 @@ +#!/bin/sh +ffmpeg -i $@ -af loudnorm=I=-16:TP=-1.5:LRA=11:measured_I=-27.61:measured_LRA=18.06:measured_TP=-4.47:measured_thresh=-39.20:offset=0.58:linear=true:print_format=summary -ar 48k loudnorm_$@ diff --git a/masskill b/masskill new file mode 100755 index 0000000..c207e66 --- /dev/null +++ b/masskill @@ -0,0 +1,4 @@ +#!/bin/bash +#kill -9 `ps -ef | grep $1 | grep -v grep | awk '{print $2}'` +for i in `ps ax | grep "$1" | grep -v grep | awk '{print $5}'` ; do echo $i ;done ; for i in `ps ax | grep "$1" | grep -v grep | awk '{print $1}'` ; do kill -9 $i ;done +#for i in `ps aux | grep "$1" | grep -v grep | awk '{print $2}'`; do kill -9 $i || echo "No such process." ; done diff --git a/metriclock b/metriclock new file mode 100755 index 0000000..9dd13d8 --- /dev/null +++ b/metriclock @@ -0,0 +1,6 @@ +#!/bin/bash +DECIMAL=`date +%H:%M:%S:0.%N | awk -F "[d :]" '{printf "%.05f", (($1*3600)+($2*60)+($3)+($4))/86400.0 }'` +HH=`echo $DECIMAL | cut -c -3 | sed -e 's/\.//'` +MM=`echo $DECIMAL | cut -c -5 | tail -c -3` +SS=`echo $DECIMAL | cut -c -7 | tail -c -3` +echo $HH:$MM:$SS diff --git a/mksketch b/mksketch new file mode 100755 index 0000000..4d6ccb9 --- /dev/null +++ b/mksketch @@ -0,0 +1,4 @@ +#!/bin/bash +mkdir $1 +cd $1 +micro $1.pde diff --git a/moonphase b/moonphase new file mode 100755 index 0000000..0673b10 --- /dev/null +++ b/moonphase @@ -0,0 +1,44 @@ +#!/usr/bin/env python +""" +moonphase.py - Calculate Lunar Phase +Author: Sean B. Palmer, inamidst.com +Cf. http://en.wikipedia.org/wiki/Lunar_phase#Lunar_phase_calculation +""" + +import math, decimal, datetime +dec = decimal.Decimal + +def position(now=None): + if now is None: + now = datetime.datetime.now() + + diff = now - datetime.datetime(2001, 1, 1) + days = dec(diff.days) + (dec(diff.seconds) / dec(86400)) + lunations = dec("0.20439731") + (days * dec("0.03386319269")) + + return lunations % dec(1) + +def phase(pos): + index = (pos * dec(8)) + dec("0.5") + index = math.floor(index) + return { + 0: "New Moon", + 1: "Waxing Crescent", + 2: "First Quarter", + 3: "Waxing Gibbous", + 4: "Full Moon", + 5: "Waning Gibbous", + 6: "Last Quarter", + 7: "Waning Crescent" + }[int(index) & 7] + +def main(): + pos = position() + phasename = phase(pos) + + roundedpos = round(float(pos), 3) + #print("%s (%s)" % (phasename, roundedpos)) + print("%s" % (roundedpos)) + +if __name__=="__main__": + main() diff --git a/moonphase.py b/moonphase.py new file mode 100755 index 0000000..fe9cb88 --- /dev/null +++ b/moonphase.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python +""" +moonphase.py - Calculate Lunar Phase +Author: Sean B. Palmer, inamidst.com +Cf. http://en.wikipedia.org/wiki/Lunar_phase#Lunar_phase_calculation +""" + +import math, decimal, datetime +dec = decimal.Decimal + +def position(now=None): + if now is None: + now = datetime.datetime.now() + + diff = now - datetime.datetime(2001, 1, 1) + days = dec(diff.days) + (dec(diff.seconds) / dec(86400)) + lunations = dec("0.20439731") + (days * dec("0.03386319269")) + + return lunations % dec(1) + +def phase(pos): + index = (pos * dec(8)) + dec("0.5") + index = math.floor(index) + return { + 0: "New Moon", + 1: "Waxing Crescent", + 2: "First Quarter", + 3: "Waxing Gibbous", + 4: "Full Moon", + 5: "Waning Gibbous", + 6: "Last Quarter", + 7: "Waning Crescent" + }[int(index) & 7] + +def main(): + pos = position() + phasename = phase(pos) + + roundedpos = round(float(pos), 3) + print "%s (%s)" % (phasename, roundedpos) + +if __name__=="__main__": + main() diff --git a/morse b/morse new file mode 100755 index 0000000..62728fe Binary files /dev/null and b/morse differ diff --git a/mpvsync b/mpvsync new file mode 100755 index 0000000..61438e9 --- /dev/null +++ b/mpvsync @@ -0,0 +1,2 @@ +#!/bin/bash +mpv --start=`date +%S.%N` "$*" diff --git a/mpvsync2 b/mpvsync2 new file mode 100755 index 0000000..7187f4b --- /dev/null +++ b/mpvsync2 @@ -0,0 +1,4 @@ +#!/bin/bash +SECS=`echo $(date +%M)*60.0+$(date +%S.%N) | bc -l` +echo $SECS +mpv --start=$SECS "$*" diff --git a/mpvsyncbpm b/mpvsyncbpm new file mode 100755 index 0000000..61aef83 --- /dev/null +++ b/mpvsyncbpm @@ -0,0 +1,8 @@ +#!/bin/bash +BPM=`mediainfo "$1" | grep BPM | head -n1 | awk '{print $3}'` +TARGET="$2" +SPEED=`echo $TARGET/$BPM | bc -l` +PITCH=`echo $BPM/$TARGET | bc -l` +echo altering tempo of track from $BPM to $TARGET that is $SPEED of original tempo +mpv --start=`date +%S.%N` --no-audio-display --af=rubberband --speed=$SPEED "$1" +#mpv --af=scaletempo=scale=$SPEED:overlap=0.5 "$1" diff --git a/now b/now new file mode 100755 index 0000000..631cb8c --- /dev/null +++ b/now @@ -0,0 +1,13 @@ +#!/bin/bash +ARGS="$*" +date +%s.%N +echo `date +%s.%N` "$ARGS" >> /home/kof/src/now/log + +cd /home/kof/src/now +git commit -am "`date +%s.%N`" +git pull +git push + +#rsync -avzu home:Downloads ~/. +#cd ~/Downloads +#cp `ls -tr | tail -n 1` "$*"; mv "$*" ~/Pictures; cd ~/Pictures && postgen "$*" diff --git a/o b/o new file mode 100755 index 0000000..519e3c1 --- /dev/null +++ b/o @@ -0,0 +1,2 @@ +#!/bin/bash +xdg-open "$*" & diff --git a/osc-sq b/osc-sq new file mode 100755 index 0000000..a9811d5 Binary files /dev/null and b/osc-sq differ diff --git a/performanceLow b/performanceLow new file mode 100755 index 0000000..6055d45 --- /dev/null +++ b/performanceLow @@ -0,0 +1,2 @@ +#!/bin/sh +sudo cpufreq-set -g performance diff --git a/pisync b/pisync new file mode 100755 index 0000000..ca5e2f6 --- /dev/null +++ b/pisync @@ -0,0 +1,2 @@ +#!/bin/sh +rsync -avu home:Downloads ~/. diff --git a/postgen b/postgen new file mode 100755 index 0000000..a1224c3 Binary files /dev/null and b/postgen differ diff --git a/pp b/pp new file mode 100755 index 0000000..3df31ac --- /dev/null +++ b/pp @@ -0,0 +1,2 @@ +sketch=`pwd` +/home/kof/processing/processing-java --sketch=$sketch --force --run @$ diff --git a/ppop b/ppop new file mode 100755 index 0000000..bc4d2a4 --- /dev/null +++ b/ppop @@ -0,0 +1,10 @@ +#!/bin/bash +SKETCH=`pwd` +OUTPUT=/tmp/processingMess/ + +killall processing-java + +cd /home/kof/Downloads/processing-3.4 && primusrun ./processing-java --sketch="$SKETCH" --output=$OUTPUT --force --run + +cd $SKETCH + diff --git a/ppp b/ppp new file mode 100755 index 0000000..41aed3d --- /dev/null +++ b/ppp @@ -0,0 +1,2 @@ +sketch=`pwd` +/home/kof/processing/processing-java --sketch=$sketch --force --present @$ diff --git a/processing b/processing new file mode 120000 index 0000000..6f98247 --- /dev/null +++ b/processing @@ -0,0 +1 @@ +/home/kof/processing/processing \ No newline at end of file diff --git a/ramfetch b/ramfetch new file mode 100755 index 0000000..758b79d --- /dev/null +++ b/ramfetch @@ -0,0 +1,146 @@ +#!/bin/sh +# MIT License +# +# Copyright (c) 2022 gentoo-btw +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +# colors for tty sessions +if [ "$TERM" = "linux" ]; then +BLK='\033[0;30m' +RED='\033[0;31m' +GRN='\033[1;32m' +YEL='\033[1;33m' +BLU='\033[0;34m' +PURP='\033[0;35m' +CYN='\033[0;36m' +WHT='\033[0;37m' +else +# colors for gui +BLK='\033[0;30m' +RED='\033[0;31m' +GRN='\033[2;32m' +YEL='\033[0;33m' +BLU='\033[0;34m' +PURP='\033[0;35m' +CYN='\033[0;36m' +WHT='\033[0;37m' +fi + +# blue arrow +BLUE_ARROW="$(printf "%b->%b" "${BLU}" "${WHT}")" +# sets version +RAMFETCH_VER="v1.0.2" + +# help and version + +if [ "$*" = "--help" ] || [ "$*" = "-h" ]; then + cat <%b" "${GRN}" "${WHT}")" +HOSTNAME="$(hostname)" +HOST_AND_USER_LEN=$(echo ${#HOSTNAME} + ${#USER} + 1 | bc) +HOST_AND_USER="$(printf "%b%s%b%c%b%s%b" "${GRN}" "$USER" "${WHT}" "@" "${YEL}" "$HOSTNAME" "${WHT}")" +COLORBLOCKS="$(printf "%b%s%b%s%b%s%b%s%b%s%b%s%b%s%b%s%b" "${BLK}" "███" "${RED}" "███" "${GRN}" "███" "${BLU}" "███" "${YEL}" "███" "${PURP}" "███" "${CYN}" "███" "${WHT}" "███" "${WHT}")" +# for ascii logo +YELLOW_PART="$(printf "%b" "${YEL}")" +GREEN_PART="$(printf "%b" "${GRN}")" +END="$(printf "%b" "${WHT}")" +# output +cat < /tmp/list +cat /tmp/list | sort > /tmp/sorted +cat /tmp/sorted diff --git a/stream.sh b/stream.sh new file mode 100755 index 0000000..cbcc10f --- /dev/null +++ b/stream.sh @@ -0,0 +1,14 @@ +# SAMPLE: FLAC streaming on Windows & Mac +while true +do + ffmpeg -f jack -i stream \ + -ar 48000 \ + -ac 2 \ + -c:a opus \ + -fflags +igndts \ + -f ogg \ + -strict -2 \ + -content_type 'application/ogg' \ + icecast://source:cigareta@pesek.ddns.net:8000/stream.ogg + sleep 1 +done diff --git a/synctime b/synctime new file mode 100755 index 0000000..8193072 --- /dev/null +++ b/synctime @@ -0,0 +1,4 @@ +#!/bin/sh + +ntpdate pool.ntp.org +hwclock --systohc --localtime diff --git a/tags b/tags new file mode 100644 index 0000000..1bce142 --- /dev/null +++ b/tags @@ -0,0 +1,53 @@ +!_TAG_EXTRA_DESCRIPTION anonymous /Include tags for non-named objects like lambda/ +!_TAG_EXTRA_DESCRIPTION fileScope /Include tags of file scope/ +!_TAG_EXTRA_DESCRIPTION pseudo /Include pseudo tags/ +!_TAG_EXTRA_DESCRIPTION subparser /Include tags generated by subparsers/ +!_TAG_FIELD_DESCRIPTION epoch /the last modified time of the input file (only for F\/file kind tag)/ +!_TAG_FIELD_DESCRIPTION file /File-restricted scoping/ +!_TAG_FIELD_DESCRIPTION input /input file/ +!_TAG_FIELD_DESCRIPTION name /tag name/ +!_TAG_FIELD_DESCRIPTION pattern /pattern/ +!_TAG_FIELD_DESCRIPTION typeref /Type and name of a variable or typedef/ +!_TAG_FIELD_DESCRIPTION!Python nameref /the original name for the tag/ +!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ +!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ +!_TAG_KIND_DESCRIPTION!Python I,namespace /name referring a module defined in other file/ +!_TAG_KIND_DESCRIPTION!Python Y,unknown /name referring a class\/variable\/function\/module defined in other module/ +!_TAG_KIND_DESCRIPTION!Python c,class /classes/ +!_TAG_KIND_DESCRIPTION!Python f,function /functions/ +!_TAG_KIND_DESCRIPTION!Python i,module /modules/ +!_TAG_KIND_DESCRIPTION!Python m,member /class members/ +!_TAG_KIND_DESCRIPTION!Python v,variable /variables/ +!_TAG_KIND_DESCRIPTION!Sh a,alias /aliases/ +!_TAG_KIND_DESCRIPTION!Sh f,function /functions/ +!_TAG_KIND_DESCRIPTION!Sh h,heredoc /label for here document/ +!_TAG_KIND_DESCRIPTION!Sh s,script /script files/ +!_TAG_OUTPUT_EXCMD mixed /number, pattern, mixed, or combineV2/ +!_TAG_OUTPUT_FILESEP slash /slash or backslash/ +!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/ +!_TAG_OUTPUT_VERSION 0.0 /current.age/ +!_TAG_PARSER_VERSION!Python 0.0 /current.age/ +!_TAG_PARSER_VERSION!Sh 0.0 /current.age/ +!_TAG_PATTERN_LENGTH_LIMIT 96 /0 for no limit/ +!_TAG_PROC_CWD /home/kof/bin/ // +!_TAG_PROGRAM_AUTHOR Universal Ctags Team // +!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/ +!_TAG_PROGRAM_URL https://ctags.io/ /official site/ +!_TAG_PROGRAM_VERSION 6.0.0 /p6.0.20221218.0/ +!_TAG_ROLE_DESCRIPTION!Python!module imported /imported modules/ +!_TAG_ROLE_DESCRIPTION!Python!module indirectlyImported /module imported in alternative name/ +!_TAG_ROLE_DESCRIPTION!Python!module namespace /namespace from where classes\/variables\/functions are imported/ +!_TAG_ROLE_DESCRIPTION!Python!unknown imported /imported from the other module/ +!_TAG_ROLE_DESCRIPTION!Python!unknown indirectlyImported /classes\/variables\/functions\/modules imported in alternative name/ +!_TAG_ROLE_DESCRIPTION!Sh!heredoc endmarker /end marker/ +!_TAG_ROLE_DESCRIPTION!Sh!script loaded /loaded/ +EOF ramfetch /^ cat < "$temp_list" + +# Funkce pro porovnávání dvou čísel pomocí bc +compare_numbers() { + local num1="$1" + local num2="$2" + if [ "$(echo "$num1 < $num2" | bc)" -eq 1 ]; then + return 0 + else + return 1 + fi +} + +# Funkce pro sčítání dvou čísel pomocí bc +add_numbers() { + local num1="$1" + local num2="$2" + echo "$num1 + $num2" | bc +} + +# Projdi všechny soubory ve složce +for video in "$input_dir"/*.MP4; do + # Zjisti délku videa (v sekundách, s přesností na tři desetinná místa) + total_seconds=$(ffmpeg -i "$video" 2>&1 | grep "Duration" | awk '{split($2,a,":"); print a[1]*3600 + a[2]*60 + a[3]}' | bc) + + # Kontrola, zda byl správně získán total_seconds + if [ -z "$total_seconds" ] || [ "$(echo "$total_seconds < 0" | bc)" -eq 1 ]; then + echo "Nelze získat délku videa pro $video. Přeskočeno." + continue + fi + + # Každých $interval sekund vystřihni klip o délce $duration sekund + start="0" + while compare_numbers "$start" "$total_seconds"; do + output_clip=$(mktemp --suffix=.mp4) + + # Přidání nuly před desetinné číslo, pokud je potřeba + start_formatted=$(printf "%.6f\n" "$start") + start_formatted=$(echo "$start_formatted" | awk '{print ($1 < 1 && $1 > 0) ? "0"$0 : $0}') + + # Výstup z ffmpeg se nyní zapisuje do /dev/null pro odstranění výstupu + ffmpeg -y -ss "$start_formatted" -i "$video" -t "$duration" -c copy "$output_clip" + + # Ověření, že klip byl správně vytvořen + if [ $? -eq 0 ]; then + echo "file '$output_clip'" >> "$temp_list" + else + echo "Při zpracování souboru $video došlo k chybě, přeskočeno." + rm "$output_clip" + fi + + # Zvýšíme startovací čas o interval + start=$(add_numbers "$start" "$interval") + done +done + +# Spoj všechny klipy do jednoho souboru, pokud je seznam klipů neprázdný +if [ -s "$temp_list" ]; then + ffmpeg -loglevel warning -f concat -safe 0 -i "$temp_list" -c copy "$output_file" +else + echo "Žádné klipy nebyly vytvořeny." +fi + +# Smaž dočasné soubory +rm "$temp_list" diff --git a/week b/week new file mode 100755 index 0000000..f34ed38 --- /dev/null +++ b/week @@ -0,0 +1,2 @@ +#!/bin/bash +find . -type f -daystart -mtime -7 | grep "$1" diff --git a/xwax-scan b/xwax-scan new file mode 100755 index 0000000..976948a --- /dev/null +++ b/xwax-scan @@ -0,0 +1,44 @@ +#!/bin/sh +# +# Take a pathname as an argument and output a playlist to standard +# output and errors to standard error. +# +# The output format is repeated sequences of: +# +# \t\t[\t<bpm>]\n +# +# If the tab (\t) or newline (\n) characters appear in a filename, +# unexpected things will happen. + +PATHNAME="$1" + +if [ -d "$PATHNAME" ]; then + find -L "$PATHNAME" -type f | + grep -iE '\.(ogg|oga|aac|cdaudio|mp3|flac|wav|aif|aiff|m4a|wma)$' +else + cat "$PATHNAME" +fi | + +# Parse artist and title information from matching filenames + +sed -n ' +{ +# /[<ABnum>[.]] <artist> - <title>.ext +s:/\([A-H]\?[A0-9]\?[0-9].\? \+\)\?\([^/]*\) \+- \+\([^/]*\)\.[A-Z0-9]*$:\0\t\2\t\3:pi +t + +# /<artist> - <album>[/(Disc|Side) <name>]/[<ABnum>[.]] <title>.ext +s:/\([^/]*\) \+- \+\([^/]*\)\(/\(disc\|side\) [0-9A-Z][^/]*\)\?/\([A-H]\?[A0-9]\?[0-9].\? \+\)\?\([^/]*\)\.[A-Z0-9]*$:\0\t\1\t\6:pi +t + +# /[<ABnum>[.]] <name>.ext +s:/\([A-H]\?[A0-9]\?[0-9].\? \+\)\?\([^/]*\)\.[A-Z0-9]*$:\0\t\t\2:pi +}' | + +# Extract BPM metadata from title (eg. "Ghostbusters (115.6 BPM)") + +sed ' +{ +# BPM +s:\(.*\) *(\([0-9]\+\.\?[0-9]\+\) *BPM)$:\1\t\2: +}' diff --git a/yesterday b/yesterday new file mode 100755 index 0000000..2d95a04 --- /dev/null +++ b/yesterday @@ -0,0 +1,2 @@ +#!/bin/bash +find . -type f -daystart -mtime -2 | grep "$1" diff --git a/youtube-effect b/youtube-effect new file mode 100755 index 0000000..8810696 --- /dev/null +++ b/youtube-effect @@ -0,0 +1,27 @@ +#!/bin/bash +playit () +{ + EFF=$1 + LOC=$2 + DIMMENSIONS='video/x-raw, pixel-aspect-ratio=1/1,width=1024,height=576' +# +# if (($SEL>=4)) +# then +# DIMMENSIONS='video/x-raw, pixel-aspect-ratio=1/1,framerate=25/1,width=1024,height=576' +# fi +# + gst-launch-1.0 souphttpsrc location="$LOC" ! tee name=t ! decodebin ! videorate ! videoscale ! $DIMMENSIONS ! queue ! tee name=a\ + a. ! decodebin ! gleffects effect=$EFF ! glimagesink\ + t. ! decodebin ! autoaudiosink +} + +############################################## + +cd ~/irclogs +./sync.sh + +for i in `./getVideos.sh|tail -n1`; do + ADDR=`youtube-dl -g "$i"`; + echo "playing pipe no: "$COUNTER; + playit $1 "$ADDR" +done diff --git a/youtube-effect2 b/youtube-effect2 new file mode 100755 index 0000000..cafb91d --- /dev/null +++ b/youtube-effect2 @@ -0,0 +1,27 @@ +#!/bin/bash +playit () +{ + EFF1=$1 + EFF2=$2 + LOC1=$3 + LOC2=$4 + DIMMENSIONS='video/x-raw,pixel-aspect-ratio=1/1,width=1024,height=576' +# +# if (($SEL>=4)) +# then +# DIMMENSIONS='video/x-raw, pixel-aspect-ratio=1/1,framerate=25/1,width=1024,height=576' +# fi +# + gst-launch-1.0 uridecodebin uri="$LOC1" use-buffering=true ! tee name=t\ + t. ! decodebin ! videorate ! videoscale ! $DIMMENSIONS ! gleffects effect=$EFF1 ! gleffects effect=$EFF2 ! glimagesink\ + uridecodebin uri="$LOC2" use-buffering=true ! decodebin ! autoaudiosink +} + +############################################## + + +#ADDR=`youtube-dl -g "ytsearch:$3"`; +ADDR=`youtube-dl -g "ytsearch:$3"`; +VIZ=`echo $ADDR | tr ' ' '\n' | head -n 1`; +SND=`echo $ADDR | tr ' ' '\n' | tail -n 1`; +playit $1 $2 "$VIZ" "$SND"