Edit firefox configurations (specifically turn on autoplay) from command line

in /home/{user}/.mozilla/firefox/prefs.js add user_pref(“media.autoplay.default”, 0); this will allow firefox to automatically start playing media in the link.

pdftotext with cropping example

pdftotext -x //x coordinate start point left top corner -y //y coordinate start point left top corner -W //width in pixels -H //height in pixels -layout // this tries to keep the layout relative to the text input.pdf output.txt pdftotext -x 120 -y 0 -W 1000 -H 1000 -layout input.pdf output.txt

add the IPs of guys trying to brute force their way into your server sshd to hosts.deny

 cat /var/log/auth.log | grep ‘sshd.*Invalid’ | grep -oE “\b([0-9]{1,3}\.){3}[0-9]{1,3}\b” | sort | uniq -u | xargs printf “ALL: %s\n” >> /etc/hosts.deny this is a work in progress. not working yet. permission problem with appending hosts.deny

Resetting MySQL password (mysql 5.7.21) on Ubuntu

1. Stop MySQL service mysql stop 2. Create the stuff mysql deletes when it quits sudo mkdir -p /var/run/mysqld sudo chown mysql:mysql /var/run/mysqld 3. Start MySQL in safe mode sudo /usr/sbin/mysqld –skip-grant-tables –skip-networking & 4. Log in MySQL prompt mysql -uroot 5. Update root password update user set authentication_string=password(“new_password”) where user=”root”; 6. Reload the GRANT […]

Direct Link to internal wordpress page

< a href=”<?php echo get_page_link( get_page_by_title( PAGE_NAME )->ID ); ?>”>Link Title</a > PAGE_NAME is replaced by the name you gave to the page you created.

Docker container back up and restoration

# Backup docker exec CONTAINER /usr/bin/mysqldump -u root –password=root DATABASE > backup.sql # Restore cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root –password=root DATABASE not specifically docker, but in mysql: mysql -u mysqlusername -p databasename < blog.sql

Under Construction

More to come, in time.