Skip to content

Instantly share code, notes, and snippets.


Michal Zuber mikaelz

View GitHub Profile
View hungarian-question-words-regex
mikaelz / slovak-question-words
Created Jul 18, 2021
Slovak question words regex for Google Search Console query filter. Based on
View slovak-question-words
(?i)^(ako|aka|ake|kde|kam|kedy|co|naco|preco|koho|odkial|kto|ktory|ktora|ktore)[" "]
mikaelz / librenms-alerts.service
Last active Oct 30, 2020
librenms systemd timers as crontab repalcement
View librenms-alerts.service
# /etc/systemd/system/librenms-alerts.service
Description=Run librenms poller
mikaelz / wc-delete-old-shop-orders.sql
Created Oct 14, 2020
Delete old (not current year) WooCommerce shop orders
View wc-delete-old-shop-orders.sql
FROM wp_postmeta
WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type = 'shop_order' AND YEAR(post_date) != YEAR(NOW()));
FROM wp_commentmeta
WHERE comment_id IN (SELECT comment_ID
FROM wp_comments
WHERE comment_post_id IN
(SELECT ID FROM wp_posts WHERE post_type = 'shop_order' AND YEAR(post_date) != YEAR(NOW()))
mikaelz / rc.lua
Created May 5, 2020
AwesomeWM spawn terminal on focused screen and tag
View rc.lua
awesome-client 'awful=require("awful");awful.spawn(terminal, {tag = mouse.screen.selected_tag})'
ffmpeg -rtsp_transport tcp \
-i rtsp://smartiptv:PASSWORD@ \
-i rtsp://smartiptv:PASSWORD@ \
-i rtsp://smartiptv:PASSWORD@ \
-i rtsp://smartiptv:PASSWORD@ \
-filter_complex "
nullsrc=size=1920x1080 [base];
[0:v] setpts=PTS-STARTPTS, scale=960x540 [upperleft];
[1:v] setpts=PTS-STARTPTS, scale=960x540 [upperright];
[2:v] setpts=PTS-STARTPTS, scale=960x540 [lowerleft];
mikaelz / ttm-dividend-yield.js
Created May 3, 2020
Google Spreadsheet script to fetch Dividend Yield from
View ttm-dividend-yield.js
function DivYieldTtm(ticker) {
var ticker = ticker || "GOOG";
ticker = encodeURI(ticker);
var response = UrlFetchApp.fetch("" + ticker + "?apikey=YOUR_API_KEY");
var result = JSON.parse(response.getContentText());
return parseFloat(result[0].dividendYielTTM);
mikaelz / YahooFinance.js
Created Apr 20, 2020
Google script to fetch stock quote data from Yahoo Finance
View YahooFinance.js
function YahooFinance(ticker) {
var ticker = ticker || "GOOG";
ticker = encodeURI(ticker);
var response = UrlFetchApp.fetch("" + ticker);
var chain = JSON.parse(response.getContentText());
return parseFloat(chain.optionChain.result[0].quote.regularMarketPrice);
$ cat /etc/profile.d/
if [ -n "$SSH_CLIENT" ]; then
TEXT="$(date): ssh login to ${USER}@$(hostnamectl --static)"
TEXT="$TEXT from $(echo $SSH_CLIENT|awk '{print $1}')"
echo $TEXT|mail -s "ssh login"
mikaelz / order-by-field.sql
Created Jul 20, 2019
Custom WP query ORDER BY with FIELD()
View order-by-field.sql
function pn_woocommerce_product_query( WP_Query $wp_query ) {
if ( $wp_query->get( 'orderby' ) == 'menu_order title' ) {
$wp_query->set( 'meta_query', [
'relation' => 'AND',
'internal_stock' => [
'key' => '_manage_stock',
'compare' => 'EXIST',
'stock_status' => [
'key' => '_stock_status',