2018/08/29

PHP to UML

I wanted a tool to convert PHP classes to UML, but I also wanted to be able to modify the result.

As a (maybe positive) side effect I had to separate all PHP classes in a particular directory in order to avoid the tool to get confused with other scripts used to generate Javascript code among other things.


(this post may require some revisions)

grab php2xmi from

http://tech.motion-twin.com/php_php2xmi.html

sample script to run on project directory:


php2xmi \
--no-private \
--no-protected \
--output=/home/rudy/borrame/myresult.xmi \
`find src/class -name "*.php"`

add --path= if you need to include other project files

once you get the XMI file, you can import it with ArgoUML

http://argouml-downloads.tigris.org/argouml-0.34/

it wont generate the UML on the fly


2018/08/05

Stylish for TW (updated)

When I do things like this I want to separate updated content from what is not.

This template removes pinned tweets among other things like the Moments, prompts, translate buttons and recommended followers.


@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document domain("twitter.com") {
#above-timeline-prompt,
.user-pinned,
.SidebarCommonModules,
.moments,
.message,
.translate-button, .GalleryNav,
.js-recommended-followers
{ display:none !important }

}


2018/08/02

network bonding on slackware 14.2

perhaps a first sloppy attempt I made to make bonding work in 14.2, based on this info

https://docs.slackware.com/howtos:misc:network_interace_bonding

inside /etc/rc.d/rc.M add (before rc.local section):

if [ -x /etc/rc.d/rc.bond ]; then
  . /etc/rc.d/rc.bond
fi



/etc/rc.d/rc.bond :
modprobe bonding

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
chmod +x rc.bond and reboot

2018/07/23

bash script to kill another script by pid file

the idea is to get the pid from a running script and save it to a file, so we can retrieve the id and kill the process. Also it should kill child processes

to create the file, during the script we must do (replace /home/mantener/var/run with another dir of your liking):

minombre=$(basename $0)
pidfile=/home/mantener/var/run/$minombre.pid
echo $$ >$pidfile

 
 and the script to make use of the pid file could be:

#!/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

2018/07/19

script to kill a specific process by name

This one was made specifically for VLC since the stupid program sometimes hangs and there is no way to close it by normal means (Quit command, etc)

#!/bin/bash
$(echo -n kill -9 ; ps -A |grep vlc |grep -o "^ [0-9]*")
what it does is to create a command line on the fly by extracting vlc process id and then execute it.

2018/07/09

Autofill forms for Chromium and Firefox

Why/when do you need it:
  • because you use the same web page from time to time and you need to fill a form with the same data (ie: user/pass)
  • related to the above, once configured with a hotkey, logging in a site in is just a second
  • security is not an issue
  • a natural complement to Lazarus addon for Firefox
  • if you are like me, who sticks to Firefox 40-48 because many addons does not work on newer versions, you might want to use Chromium for specific web pages
Firefox version:

https://firefox.add0n.com/autofill-forms.html

for Chromium

https://add0n.com/autofillforms-e10s.html

compared with the Addon for Firefox (version 1.1.8), Chromium addon is horrible beyond belief. I feel like some software developers are treating users as if they were morons incapable of thinking for themselves so they try to spoon-feed them with fancy dialogs and buttons limiting what they can and cannot do. Proof of that is the first item on the Features list: "Easy configuration with a simple interface"

2018/06/16

stylish for stackexchange

removes annoying cookies usage notice (which I have them blocked with CookieMonster anyway):

@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document domain("stackexchange.com") {
#js-gdpr-consent-banner
  { display: none !important; }
}