Skip to content

Instantly share code, notes, and snippets.

View mikaelz's full-sized avatar

Michal Zuber mikaelz

View GitHub Profile
<?php
declare(strict_types=1);
namespace App\Infrastructure\Serializer;
use Symfony\Component\Serializer\Encoder\DecoderInterface;
use Symfony\Component\Serializer\Encoder\EncoderInterface;
class FormEncoder implements EncoderInterface, DecoderInterface
@mikaelz
mikaelz / wp-login-download-pdf.sh
Created May 20, 2023 09:58
Wget PDF files after logging into WordPress
#!/bin/bash
# Login
wget --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3" \
--save-cookies cookies.txt --keep-session-cookies --no-check-certificate --delete-after \
--post-data="log=REPLACE_WITH_LOGIN&pwd=REPLACE_WITH_PASS&testcookie=1" https://example.com/wp-login.php
# Download PDFs
wget --mirror --load-cookies cookies.txt --keep-session-cookies --no-check-certificate \
--random-wait -e robots=off -A.pdf --page-requisites --adjust-extension --convert-links --backup-converted --no-parent \
SYSTEMD_COLORS=false multitail -l 'journalctl -f' -l 'ssh router /log print follow-only'
@mikaelz
mikaelz / docker-mariadb-mysqldump.sh
Last active March 23, 2023 07:08
MariaDB mysqldump via docker image
#/bin/bash
DB_HOST="HOST"
DB_PORT=3306
DB_USER="USER"
DB_PASS="PASS"
DB_NAME="NAME"
BACKUP_DIR="$HOME/Dropbox/sql"
DB_FILE="dump.sql"
@mikaelz
mikaelz / vpnwidget.lua
Created March 6, 2023 11:53 — forked from thatarchguy/vpnwidget.lua
Awesomewm vpn widget
-- add this to your rc.lua, or include it as a dependency
-- Don't forget to add this to the layout section:
-- right_layout:add(protonvpnwidget)
protonvpnwidget = wibox.widget.textbox()
protonvpnwidget:set_text(" ProtonVPN: N/A ")
protonvpnwidgettimer = timer({ timeout = 5 })
protonvpnwidgettimer:connect_signal("timeout",
function()
#!/bin/bash
cd /tmp
echo "Wget $1"
wget --spider --recursive --level=3 --no-verbose --output-file=sitemap.txt $1
echo "Grep URLs"
grep -i URL /tmp/sitemap.txt | awk -F 'URL:' '{print $2}' | awk '{$1=$1};1' | awk '{print $1}' | sort -u | sed '/^$/d' > /tmp/sitemap-urls.txt
header='<?xml version="1.0" encoding="UTF-8"?><urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
(hol|hova|honnan|merre|mettol|meddig|mennyi|hany|hanyfele|mekkora|mifele|melyik|milyen|mikent|miert|hogyan|mikor|mikortol|mikent|mennyi|honnan|miota)
@mikaelz
mikaelz / slovak-question-words
Created July 18, 2021 04:23
Slovak question words regex for Google Search Console query filter. Based on https://twitter.com/DataChaz/status/1416330157749583872
(?i)^(ako|aka|ake|kde|kam|kedy|co|naco|preco|koho|odkial|kto|ktory|ktora|ktore)[" "]
@mikaelz
mikaelz / librenms-alerts.service
Last active October 30, 2020 12:55
librenms systemd timers as crontab repalcement
# /etc/systemd/system/librenms-alerts.service
[Unit]
Description=Run librenms poller
[Service]
Type=oneshot
ExecStart=/opt/librenms/alerts.php
User=librenms