Skip to content

Instantly share code, notes, and snippets.

@brablc
brablc / mscreen
Created September 15, 2011 14:05
mscreen - write into multiple screens at once
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Usage: mscreen [hostname1] [hostname2] ..."
exit 1
fi
TMPFILE="/tmp/mscreen-$$"
echo "source $HOME/.screenrc" >$TMPFILE
#!/usr/bin/env python
"""
FUNCTION: Converts a CSV (tab delimited) file to an Excel xlsx file.
Copyright (c) 2012, Konrad Foerstner <konrad@foerstner.org>
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all
copies.
@brablc
brablc / postfix_grok_pattern
Last active September 27, 2020 20:10
Logstash example configuration for parsing Postfix mail log files
# Postfix stuff based on https://gist.github.com/jbrownsc/4694374:
QUEUEID (?:[A-F0-9]+|NOQUEUE)
EMAILADDRESSPART [a-zA-Z0-9_.+-=:]+
EMAILADDRESS %{EMAILADDRESSPART:local}@%{EMAILADDRESSPART:remote}
RELAY (?:%{HOSTNAME:relayhost}(?:\[%{IP:relayip}\](?::[0-9]+(.[0-9]+)?)?)?)
POSREAL [0-9]+(.[0-9]+)?
DELAYS (%{POSREAL}[/]*)+
DSN %{NONNEGINT}.%{NONNEGINT}.%{NONNEGINT}
STATUS sent|deferred|bounced|expired
@brablc
brablc / psa-monit.conf
Created September 21, 2013 13:44
Fix for Plesk 11.5.30 and Watchdog 2.0.7
--- psa-monit.conf.orig 2013-09-21 15:05:09.000000000 +0200
+++ psa-monit.conf 2013-09-21 15:25:48.000000000 +0200
@@ -1,11 +1,18 @@
# psa-monit
description "Plesk Watchdog Monitor service"
author "Parallels <info@parallels.com>"
-start on starting rc RUNLEVEL=[2345]
+start on runlevel [2345]
#!/usr/bin/osascript
-- Launche multiple SSH session
-- completely rewritten but inspired by github:xgdlm/iterm2-cssh
on run argv
set serverList to argv
-- Print help if no servers are given
@brablc
brablc / shoptet-gtm-example.js
Last active July 10, 2023 17:24
Shoptet GTM Example
var dataHelper = new DataLayerHelper(dataLayer);
// Page type is one of:
// checkout: cart, billingAndShipping, customerDetails, thankYou
// other: homepage, article, category, productDetail, section
var pageType = dataHelper.get('shoptet.pageType');
// On any page, you can check for content of cart.
// It contains pairs productCode => itemCount
var cart = dataHelper.get('shoptet.cart');
@brablc
brablc / TerminalVim.scpt
Last active December 24, 2016 01:30
Open Vim in Terminal (iTerm) from Finder - copied from http://thepugautomatic.com/2015/02/open-in-iterm-vim-from-finder/ and updated to open in the current terminal
on run {input, parameters}
set cmd to "vim -c startinsert"
if input is not in {} then
set myPath to POSIX path of input
set cmd to "vim " & quote & myPath & quote
end if
tell application "iTerm"
activate
set myTerm to (current terminal)
@brablc
brablc / dig_adisepo_output.txt
Created March 18, 2015 20:27
Portal danove spravy vypadava z Google DNS
$ dig adisepo.mfcr.cz
; <<>> DiG 9.8.3-P1 <<>> adisepo.mfcr.cz
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14083
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;adisepo.mfcr.cz. IN A
@brablc
brablc / SigningTable.lua
Created March 19, 2015 11:36
SignigTable.lua for opendkim
-- On startup opendkim executes the script but does not give any query
if query == nil then
return "%"
end
return query
@brablc
brablc / KeyTable.lua
Last active August 29, 2015 14:17
KeyTable.lua for opendkim
-- If there is no "@dkim" it means we did not get X-DKIM-Sender header, but From instead.
if query == nil or string.find( query, "@dkim$" ) == nil then
query = "default=news.shoptet.cz@dkim"
end
signer = string.gsub( query, "@.*", "")
-- Before =
s = string.gsub( signer, "=.*", "")
-- After =