From ede5f7e58404842730cb5ae8956494778747c57f Mon Sep 17 00:00:00 2001 From: David Marec Date: Mon, 26 Apr 2021 14:11:32 +0200 Subject: [PATCH] trucs en vrac --- SixM.sh | 20 ++++++++++++++++++ getroot.sh | 9 ++++++++ icu.sh | 17 +++++++++++++++ itsalltext.sh | 3 +++ nestX.sh | 8 +++++++ recording | 1 + rename.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ ripping.sh | 10 +++++++++ scripttest.sh | 6 ++++++ soxit.sh | 6 ++++++ tomp3.sh | 5 +++++ txxd.sh | 11 ++++++++++ unpinrox.sh | 2 ++ utf8.sh | 10 +++++++++ withinajail.sh | 17 +++++++++++++++ 15 files changed, 182 insertions(+) create mode 100644 SixM.sh create mode 100755 getroot.sh create mode 100644 icu.sh create mode 100755 itsalltext.sh create mode 100755 nestX.sh create mode 100644 recording create mode 100755 rename.sh create mode 100755 ripping.sh create mode 100755 scripttest.sh create mode 100644 soxit.sh create mode 100755 tomp3.sh create mode 100644 txxd.sh create mode 100755 unpinrox.sh create mode 100755 utf8.sh create mode 100755 withinajail.sh diff --git a/SixM.sh b/SixM.sh new file mode 100644 index 0000000..a129194 --- /dev/null +++ b/SixM.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# Six month ago +# ------------- + +SIXM=`date -j -v"-6m" +"%F %T"` + +## Epoc +SIXM_EPOC=`date -j -f "%F %T" "$SIXM" "+%s"` + +## express SQL date into epoc time +## + +SQL_DATE_EPOC=`date -j -f "%F %T" "${1}" "+%s"` + +## test sql_date < sixm + +[ "${SQL_DATE_EPOC}" -gt "$SIXM_EPOC" ] && echo "match" + + diff --git a/getroot.sh b/getroot.sh new file mode 100755 index 0000000..c33f636 --- /dev/null +++ b/getroot.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +[ `id -u` -eq 0 ] && echo "Bonjour MaƮtre." && exit 0 + +sudo -s && exit 0 + +echo 'giving up.' +echo 1 + diff --git a/icu.sh b/icu.sh new file mode 100644 index 0000000..0625574 --- /dev/null +++ b/icu.sh @@ -0,0 +1,17 @@ +#!/bin/sh +bname=`echo $1 | cut -sd / -f 4- ` +oname=`echo /usr/home/david/newmusique/$bname` +icname=`echo $oname | iconv -c -s -f ISO8859-1 -t UTF-8` +oggname=`echo $oname | sed -E -e 's/\....$/.ogg/'` + +#echo Processing $1 +mkdir -p -- "$(dirname -- "$icname")" +if [ ! -f "$oggname" ]; then + echo building $oggname + sox "$1" "$oggname" +fi + +#cp "$1" "$icname" +#sox "$1" + + diff --git a/itsalltext.sh b/itsalltext.sh new file mode 100755 index 0000000..6ac7822 --- /dev/null +++ b/itsalltext.sh @@ -0,0 +1,3 @@ +#!/bin/sh +xterm -title "view file" -e vim -p "$@" + diff --git a/nestX.sh b/nestX.sh new file mode 100755 index 0000000..1386a9c --- /dev/null +++ b/nestX.sh @@ -0,0 +1,8 @@ +#! /bin/sh +Xephyr -ac -screen 1280x1024 -br -reset :1& +export DISPLAY=:1.0 +#start-lumina-desktop +enlightenment_start +pkill Xephyr + + diff --git a/recording b/recording new file mode 100644 index 0000000..03273b6 --- /dev/null +++ b/recording @@ -0,0 +1 @@ +sudo cdrecord -v speed=1 dev=0,0 -dao -useinfo -audio -pad myCD/track1.wav myCD/track10.wav myCD/track11.wav myCD/track2.wav myCD/track3.wav myCD/track4.wav myCD/track5.wav myCD/track6.wav myCD/track7.wav myCD/track8.wav myCD/track9.wav diff --git a/rename.sh b/rename.sh new file mode 100755 index 0000000..8564898 --- /dev/null +++ b/rename.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +usage() { + echo 'Usage: ${0} -p prefix [-d directory] [-t extension] [-u]' + echo " -p prefix to be removed" + echo " -d destination folder" + echo " default current directory" + echo " -t files extension" + echo " default to ogg" + echo " -u encode filename in UTF-8" + echo '---------------------' +} + +processing() +{ + echo processing "${@}" + newfile=`echo "$@" | sed "s/${prefix}//g"` + [ -n ${iconv} ] && newfile=`echo ${newfile} | iconv -c -t UTF-8` + echo " : copying <$newfile> into <${dest}>" + cp "${@}" "${dest}/${newfile}" +} + +while getopts "p:d:t:u" option +do + case ${option} in + p) + prefix="${OPTARG}" + ;; + d) + dest="${OPTARG}" + ;; + t) + ext="${OPTARG}" + ;; + u) iconv="y" + ;; + *) + usage + exit 1 + ;; + + esac +done + +dest=${dest:-.} +ext=${ext:-ogg} +[ -z "${dest}" ] && usage && exit 1 +[ -z "${prefix}" ] && usage && exit 1 + +echo +echo "Copy and rename ${ext} files, removing <${prefix}> prefixes, into <${dest}>." +[ -n "${iconv}" ] && echo '* Filename UTF-8 encoding is on.' +echo +mkdir -p "${dest}" || (echo "unable to create ${dest}" && exit 1) + +find . -maxdepth 1 -type f -name "*.${ext}" -print | while IFS= read file; do processing "${file}" ; done + diff --git a/ripping.sh b/ripping.sh new file mode 100755 index 0000000..c025b3b --- /dev/null +++ b/ripping.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# mkdir -p ~/tmp/cd +# cd ~/tmp/cd +# cdparanoia -B -d /dev/d0 +for i in `ls *.wav`; do + lame -m s "$i" -o "$(echo $i | awk '{print substr($0,6,2)}' -).mp3" +# rm -f "$i" +done +echo files are in $PWD +exit 0 diff --git a/scripttest.sh b/scripttest.sh new file mode 100755 index 0000000..67f527b --- /dev/null +++ b/scripttest.sh @@ -0,0 +1,6 @@ +#/bin/sh +setenv LC_CTYPE ISO8859-1 +find -E /data/musique/ -type f -iregex '.*.((ogg)|(mp3)|(mpc)|(wav)|(m4a))$' -exec sh ./icu.sh {} \; +#ls -R /data/musique/ | egrep -i '.*.((ogg)|(mp3)|(mpc)|(wav)|(m4a))$' | xargs icu.sh + + diff --git a/soxit.sh b/soxit.sh new file mode 100644 index 0000000..9cf42ca --- /dev/null +++ b/soxit.sh @@ -0,0 +1,6 @@ +#/bin/sh +for I in *.wav +do + sox $I $I.cdr +done + diff --git a/tomp3.sh b/tomp3.sh new file mode 100755 index 0000000..378b688 --- /dev/null +++ b/tomp3.sh @@ -0,0 +1,5 @@ +#!/bin/sh +for i in `ls "$@"`; do +# sox "$i" "$i".mp3 +echo "$i" +done diff --git a/txxd.sh b/txxd.sh new file mode 100644 index 0000000..985911d --- /dev/null +++ b/txxd.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +where=/home/david +to=/home/david/test +for i in `find ${where} -maxdepth 1 -type f -exec echo "{}" \;`; do + + match=$( xxd -l 6 -s 0 -ps ${i} ) + [ "${match}" = "6c73202d6c20" ] && echo "${i}" "${to}/" + +done + diff --git a/unpinrox.sh b/unpinrox.sh new file mode 100755 index 0000000..842f722 --- /dev/null +++ b/unpinrox.sh @@ -0,0 +1,2 @@ +#!/bin/sh +rox --pinboard= diff --git a/utf8.sh b/utf8.sh new file mode 100755 index 0000000..dfaf2bf --- /dev/null +++ b/utf8.sh @@ -0,0 +1,10 @@ +#!/bin/sh +export MM_CHARSET=UTF-8 +export LANG=fr_FR.UTF-8 +export LC_ALL=fr_FR.UTF-8 +export LC_COLLATE=fr_FR.UTF-8 +export LC_CTYPE=fr_FR.UTF-8 +export LC_MESSAGES=fr_FR.UTF-8 +export LC_MONETARY=fr_FR.UTF-8 +export LC_NUMERIC=fr_FR.UTF-8 +export LC_TIME=fr_FR.UTF-8 diff --git a/withinajail.sh b/withinajail.sh new file mode 100755 index 0000000..703d6f7 --- /dev/null +++ b/withinajail.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +within_a_jail() +{ + return $(sysctl -n security.jail.jailed) +} +if within_a_jail; then + echo You r in a jail + C_BOLD_S="\033[1m"; C_BOLD_E="\033[0m" + C_CYAN_S="\e[1;36m"; C_CYAN_E="\e[1;36m\e[0m" + C_GREEN_S="\e[1;32m"; C_GREEN_E="\e[1;32m\e[0m" + C_YELLOW_S="\e[1;33m"; C_YELLOW_E="\e[1;33m\e[0m" + C_RED_S="\e[1;31m"; C_RED_E="\e[1;31m\e[0m" + C_MAGENTA_S="\e[1;35m"; C_MAGENTA_E="\e[1;35m\e[0m" +else + echo ok. Not jailed. +fi -- 2.47.0