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

2018/04/24

new install to-do list

this post is a work in progress:

after installing slackware, things to do besides the normal setup like configuring network card:

copy ssh keys from old install
copy /etc/sshd config?
copy .bashrc from old home install or the entire home directory
user groups review? (seems like its no longer needed under Slackware 14.2)
xorgsetup ? only if needed
compat32
libreoffice ?
wine?
firefox 40 (yes I stick to this version until Firefox can fix newer versions problems).


kde: fix nasty konsole prompt, edit Shell: /bin/bash -l


Installing PHP 7 from source

this post assumes you are familiar with Slackware 14.2 and have php 5.6 installed

  1. Donwload php from sources, and extract it
  2. inside the sources, create a script with this code or copy/paste on bash:
    #!/bin/bash
    ./configure \
        --with-config-file-path=/etc \
        --with-config-file-scan-dir=/etc \
        --enable-mbstring \
        --enable-zip \
        --enable-bcmath \
        --enable-pcntl \
        --enable-ftp \
        --enable-exif \
        --enable-calendar \
        --enable-sysvmsg \
        --enable-sysvsem \
        --enable-sysvshm \
        --enable-wddx \
        --enable-intl \
        --with-curl \
        --with-iconv \
        --with-gmp \
        --with-pspell \
        --with-gd \
        --with-jpeg-dir=/usr \
        --with-png-dir=/usr \
        --with-zlib-dir=/usr \
        --with-xpm-dir=/usr \
        --with-freetype-dir=/usr \
        --enable-gd-jis-conv \
        --with-openssl \
        --with-pdo-mysql=/usr \
        --with-gettext=/usr \
        --with-zlib=/usr \
        --with-bz2 \
        --with-apxs2=/usr/bin/apxs \
        --with-mysqli=/usr/bin/mysql_config \
        --with-ldap \
      --with-libdir=lib64
    edit: the long line from above as one line:
    ./configure --with-config-file-path=/etc --with-config-file-scan-dir=/etc --enable-mbstring --enable-zip --enable-bcmath --enable-pcntl --enable-ftp --enable-exif --enable-calendar --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --enable-intl --with-curl --with-iconv --with-gmp --with-pspell --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-xpm-dir=/usr --with-freetype-dir=/usr --enable-gd-jis-conv --with-openssl --with-pdo-mysql=/usr --with-gettext=/usr --with-zlib=/usr --with-bz2 --with-apxs2=/usr/bin/apxs --with-mysqli=/usr/bin/mysql_config --with-ldap --with-libdir=lib64

  3. make
  4. make test
  5. su
  6. make install
  7. edit /etc/httpd/mod_php.ini and comment lib_php5.so line
  8. rc.httpd restart

2018/04/13

running ATEM Software Control under Slackware


while this blog has a foolproof method for ubuntu, I believe I took a shortcut and managed to make it work under wine32 because you don't really need to install it to make it work, just like old fashioned software. Besides: installing wine64 just to install ATEM and then install win32 to run it sound more like a hack than a "propper" solution.

In case you dont have it already installed wine:
http://www.slackware.com/~alien/slackbuilds/wine/

1) on a Win setup, make a copy/compressed file of ATEM Software control
2) copy/decompress it on a Slackware box

then cd to the "Blackmagic Design/Blackmagic ATEM Switchers" and do

$ regsvr32 BMDSwitcherAPI.dll 
because if you dont the software will complain for missing DLLs.

and then you can run it:
$ wine ATEM\ Software\ Control.exe