slackware:
cd /var/log/httpd
or debian
cd /var/log/apache2
clear ; cat error.log | grep PHP | grep -P '(.*])\K.*' -o |sort -u
slackware:
cd /var/log/httpd
or debian
cd /var/log/apache2
clear ; cat error.log | grep PHP | grep -P '(.*])\K.*' -o |sort -u
while most of the time connecting to a remote server using openvpn would be a smart choice, sometimes it's not an option. This script is for a linux behind a firewall/router. It's intended to prevent SSH attacks (by simply denying access to the SSH port) while allowing you to connect from your own dynamic DNS, that is, if you have a dynamic ip given by your ISP, otherwise you could simply use iptables.
#!/bin/bash
valor=`host yourdyndns`
OK=$?
if [ $OK -ne 0 ]; then
exit
fi
addr=$(echo $valor |egrep "address .*" -o)
ip=$(echo $parte |egrep "[0-9\.]*" -o)
whitelist=/root/whitelist
touch ${whitelist}
exists=`cat ${whitelist} | grep "${parte2}"`
if [ $? -ne 0 ]; then
echo $ip >$whitelist
iptables -F iptables -A INPUT -s $ip -j ACCEPT
iptables -A FORWARD -s $ip -j \ ACCEPT
iptables -A INPUT -p tcp --dport 22022 -j DROP
fi
add this to rc.local to reload iptables during bootup:
# delete whitelist
rm /root/whitelist
# run previous script
/root/bin/testso.sh
I had to write something. This was kinda shocking to me. I was looking for a KVM (Keyboard, Video and Mouse) software to be able to control my notebook from my PC. Been using an old free version of Synergy, but for some odd reason seems to be compiled for 32 bits and I felt it was a terrible waste to install multilib just to run it. So I decided to look for an alternative.
As usual, went to google and discovered that Slackbuilds has Barrier but when I tried to install it, it asked for avahi, and avahi asked for something else and that something else asked for other-something-else. So I gave up. Then I came across x2x.
This particular software has a wikipedia page so I wont bother telling the story about it.
cd
mkdir -p install/util/x2x
cd install/util/x2x
wget https://slackbuilds.org/slackbuilds/14.2/desktop/x2x.tar.gz
tar xf x2x.tar.gz
cd x2x
wget https://slackware.uk/~urchlay/src/x2x-1.30_beta+20200121_ec10215.tar.xz
su
./x2x.SlackBuild
installpkg /tmp/x2x-1.30_beta+20200121_ec10215-x86_64-1_SBo.tgz
then I have to create an script to connect to my notebook, but before I get into that I had to read the man page, last section, after the examples, gives an important tip when you have multiple monitors
Left: 1920*1080 (primary)
Right: 1366*768
So I had to do the math and write the parameters to x2x according to the man page:
#!/bin/bash
ssh -YC rudy@macabra x2x -north -to :0.0 -big -completeregionleft 0 -completeregionup 0 -completeregionright 3286 -completeregionlow 768
I have ssh configured so it wont ask me for password. North parameter means I placed my notebook "over" my monitors and it doesn't really matter from which monitor my mouse goes up, it appears on my notebook and it's able to travel the entire notebook screen.
What shocked me about this is the fact it's a very old proyect, but works like a charm.
My router is a Linux PC with 2 lan boards, one for local lan and the other directly connected to the ISP router (configured as bridge). Each time my ISP disconnects me for whatever reason I had to either reboot the computer or keep running rc.inet1 restart until the connection is made.
So, even if it doesn't happen often, at one point I got bored of it and decided to write an script to force the reconnection as soon as possible:
#!/bin/bash
while true ; do
clear
./rc.inet1 restart
ping google.com -c 1
if [ $? == 0 ]; then
exit
fi;
sleep 30
done
export PATH=$PATH:~/bin:
#!/bin/bashyou can replace the question with the actual command but I don't recommend it.
proc=$(ps -A |grep $1 | head -n 1)
if [ -z "$proc" ] ; then
echo Error: no processes found with the given partial name!
exit 1
fi
echo ps -A says:
echo $proc
procid=$( echo "$proc" |grep "[0-9]*" -o |head -n 1)
echo "kill? <Y/N>"
read answer
if [ "$answer" != "${answer#[Yy]}" ] ;then
echo Yes
kill -9 $procid
echo Testing if the process is still alive ...
isdead=$(ps -A |grep "$proc")
[ -z "$isdead" ] && echo Process has been terminated! || echo process is still alive !?
else
echo No!
fi
rudy@madcat3:~/bin$ cat convertir.h265.sh
#!/bin/bash
mkdir 264
for file in *.mkv
do ffmpeg -n -i "${file}" -map 0 -c:a aac -c:s copy -c:v libx264 264/"${file}"
done
#!/bin/bashfirst parameter is the location of the dir containing the tests, or the test Suite. Second parameter is the directory from where inotifywait should watch for changes on filesystem.
clear
inotifywait -m --format %w%f -q -r -e close_write $1 $2 | \
while read CUAL
do
if [ $? == 0 ]; then
clear
phpunit.phar --color $1
fi
done
php2xmi \
--no-private \
--no-protected \
--output=/home/rudy/borrame/myresult.xmi \
`find src/class -name "*.php"`
if [ -x /etc/rc.d/rc.bond ]; then
. /etc/rc.d/rc.bond
fi
modprobe bondingchmod +x rc.bond and reboot
ip addr add 192.168.111.3/24 dev bond0
ip link set bond0 up
ip link set eth0 master bond0
ip link set eth1 master bond0
ifconfig eth0 up
ifconfig eth1 up
ip route add default via 192.168.111.13 dev bond0
minombre=$(basename $0)
pidfile=/home/mantener/var/run/$minombre.pid
echo $$ >$pidfile
#!/bin/bash
pidfile=/home/mantener/var/run/$1.pid
if [ ! -f $pidfile ] ; then
echo missing $pidfile !
logger $0 missing $pidfile !
exit -1
fi
cualpid=$(cat $pidfile)
# get child processes
resto=$(ps --ppid $cualpid -o pid --no-headers)
echo killing $1
kill -9 $cualpid
while IFS= read -r line ; do
echo killing $line
kill -9 $line
done <<< "$resto"
rm $pidfile
#!/bin/bashwhat it does is to create a command line on the fly by extracting vlc process id and then execute it.
$(echo -n kill -9 ; ps -A |grep vlc |grep -o "^ [0-9]*")
#!/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
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
dd if=/dev/zero of=/dev/sda bs=1M
#!/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
#!/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
find /usr |grep "geany.pc"
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
#!/bin/bashedit: 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