2018/06/12

ffmpeg: converting m4a to mp3 script

to be able to do this, ffmpeg must be compiled with mp3 support.


#!/bin/bash
mkdir mp3
for file in *.m4a
   do ffmpeg -i "${file}" -vn -ar 44100 -ac 2 -ab 128k -f mp3 mp3/"${file/%m4a/mp3}"
done

2018/06/06

"unable to un/install on windows" error

a quick list of things to check:
MSIEXEC /UNREGISTER
MSIEXEC /REGSERVER

or

HKEY_LOCAL_MACHINE \Software\Microsoft\Windows\CurrentVersion\Installer\InProgress   

or

HKEY_LOCAL_MACHINE \System\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations


HKEY_LOCAL_MACHINE \Software\Microsoft\Windows\CurrentVersion\Installer

2018/06/05

zeroing a disk on linux using DD

WARNING: if you don't really understand what are you doing (even if you THINK you are), then start learning/reading first or asking someone who really understands linux BEFORE doing something stupid like erasing a wrong disk by mistake.

if you need to wipe the content of a hard disk (REPLACE /dev/sda with the appropiate device !):

dd if=/dev/zero of=/dev/sda bs=1M 

last parameter (block size) makes the process a lot faster

2018/05/26

inotifywait example

edit: modified parameter "-n 1" to the "head" command

for this example I'm assuming text files:
to avoid confusions long lines are splitted with \


#!/bin/bash

if [ $# -ne 2 ]
    then
    echo "$0 <src dir> <dst dir>"
    exit
fi

clear

inotifywait $1 -qmre CLOSE_WRITE \
--format='%f' | while read WHICHONE ; do  

   if [ $? != 0 ]; then exit; fi;
   LINESELECTED=$(head -n 1 $WHICHONE | \
grep CONDITION)

if[ $LINESELECTED -eq 1 ] then
   cp $1/$WHICHONE $2
fi


done

2018/05/17

bash scripts for directories based on date

#!/bin/bash

#Path YYYYMMDD
ANO=$(date +%Y)
MES=$(date +%m)
DIA=$(date +%d)
FULL=$ANO$MES$DIA

if [ "$FULL" == "" ]; then
    exit 1
fi

#generar directorio destino
DIRDESTINO=/picadora/eimpresa/fotos/$ANO$MES$DIA
mkdir -p $DIRDESTINO
chmod 777 $DIRDESTINO

mkdir -p $DIRDESTINO/tapa
chmod 777 $DIRDESTINO/tapa

# generar link simbolico a HOY
cd /picadora/eimpresa/fotos
rm hoy
ln -s $DIRDESTINO hoy
cd $DIRDESTINO

# lo que siga despues

2018/05/04

phpunit script

assuming theres a test directory inside a project where the source files are held:

#!/bin/bash

if [ $# -ne 2 ]
    then
    echo "testphp <test dir> <src dir>"
    echo "example: $ testphp test ."
    exit
fi

clear

inotifywait $2 -qmre CLOSE_WRITE --format='%f' | while read CUAL ; do  
   if [ $? != 0 ]; then exit; fi;
   clear
   phpunit.phar --log-junit /tmp/ultimo.txt --color -v $1
done

2018/04/29

geany plugins for 1.33

assuming:
  • have geany 1.33 installed
  • you want to use geany pluings for the same version
  • you have downloaded and unpacked source distribution 
  • you get an error while running ./configure under slackware64 14.2 similar linux flavor
if configure complains no "geany.pc", to solve this:


find /usr |grep "geany.pc"

take note where the "geany.pc" is located and append to PKG_CONFIG_PATH

ie if the file is located under /usr/local/lib/pkgconfig

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig

then you can run ./configure again without errors