Skip to content

Instantly share code, notes, and snippets.

@tuxmartin
tuxmartin / compile.sh
Last active October 7, 2021 21:14
Inno Setup on Linux (Docker)
docker run --rm -i -v "$PWD:/work" \
-e OVPN_VER="2.5.3" \
-e OVPN_BIN32="OpenVPN-2.5.3-I601-x86.msi" \
-e OVPN_BIN64="OpenVPN-2.5.3-I601-amd64.msi" \
-e OVPN_CONF="user.ovpn" \
-e OVPN_SITE="vpn.example.net" \
-e OUT_NAME="vpn_rdp_setup" \
-e PASSWORD="asdf" \
amake/innosetup:64bit openvpn_rdp_docker.iss
@tuxmartin
tuxmartin / .htaccess
Created August 25, 2020 10:03
apache http basic auth for url wp-login.php
# --- HTTP BASIC AUTH /wp-login.php ------------------
SetEnvIf Request_URI "/wp-login.php" auth=1
AuthName "Please login."
AuthType Basic
AuthUserFile /var/www/.htpasswd
Order Allow,Deny
Satisfy any
Allow from all
@tuxmartin
tuxmartin / add_hosts.py
Created June 27, 2020 14:12
pyzabbix example
from pyzabbix import ZabbixAPI
import sys
import argparse
url = 'http://localhost/'
user = 'Admin'
password = 'zabbix'
CLI=argparse.ArgumentParser()
CLI.add_argument(
@tuxmartin
tuxmartin / app.yml
Last active October 1, 2022 15:03
IoT: ESPHome current transformer
esphome:
name: test
platform: ESP32
board: esp32doit-devkit-v1
wifi:
ssid: "My_WiFi_AP"
password: "secretPassword123"
ap:
ssid: "Test Fallback Hotspot"
@tuxmartin
tuxmartin / imap_quota_check.py
Created April 2, 2020 10:38
Vypsani stavu IMAP kvoty
import imaplib, re
import os
p = re.compile('d+')
# ---------------------------------
login="user@example.net"
password="password123"
imap_server="example.net"
imap_port=993
@tuxmartin
tuxmartin / docker-compose.yml
Last active March 24, 2020 12:58
Apache Guacamole
version: "3"
services:
init-guacamole-db:
image: guacamole/guacamole:latest
command: ["/bin/sh", "-c", "test -e /init/initdb.sql && echo 'init file already exists' || /opt/guacamole/bin/initdb.sh --postgres > /init/initdb.sql" ]
volumes:
- dbinit:/init
postgres:
@tuxmartin
tuxmartin / gist:d86880b14ef882f447b9b9bcf4d4a764
Created September 13, 2019 08:05
Kompilace Samba 4 na CentOS 7
https://wiki.samba.org/index.php/Joining_a_Samba_DC_to_an_Existing_Active_Directory
yum install perl gcc libacl-devel libblkid-devel gnutls-devel readline-devel python-devel gdb pkgconfig krb5-workstation zlib-devel setroubleshoot-server libaio-devel setroubleshoot-plugins policycoreutils-python libsemanage-python setools-libs-python setools-libs popt-devel libpcap-devel sqlite-devel libidn-devel libxml2-devel libacl-devel libsepol-devel libattr-devel keyutils-libs-devel
cyrus-sasl-devel cups-devel bind-utils libxslt docbook-style-xsl openldap-devel pam-devel bzip2 vim wget openldap-devel openldap-clients nss-pam-ldapd pam-devel net-tools
./configure --enable-debug --enable-selftest --with-ads --with-systemd --with-winbind
make -j
make install
cat /etc/systemd/system/samba.service
martin@martin:~$ whois -h whois.arin.net "n google" | grep -i '^Google' | sed 's/.*)//' | tr -d ' '
2620:E7:4000::-2620:E7:4000:FFFF:FFFF:FFFF:FFFF:FFFF
2620:E7:C000::-2620:E7:C000:FFFF:FFFF:FFFF:FFFF:FFFF
108.170.192.0-108.170.255.255
108.177.0.0-108.177.127.255
142.250.0.0-142.251.255.255
172.217.0.0-172.217.255.255
172.253.0.0-172.253.255.255
173.194.0.0-173.194.255.255
192.178.0.0-192.179.255.255
@tuxmartin
tuxmartin / gist:d3fd5975bccee1441a302e76faa3d874
Created March 7, 2019 13:00
fail2ban wordpress sql injection
# https://plugins.svn.wordpress.org/wp-fail2ban/trunk/filters.d/wordpress-hard.conf
# https://github.com/TrogloGeek/fail2ban-apache-sqlinject
# Test: fail2ban-regex /var/log/apache2/access.log /etc/fail2ban/filter.d/wordpress.conf
[INCLUDES]
before = common.conf
[Definition]
public function checkIfSeznam():bool
{
return $this->get('utm_source') === 'www.seznam.cz' && in_array($this->get('utm_medium'), ['sekce-z-internetu', 'z-boxiku']);
}