Skip to content

Instantly share code, notes, and snippets.

Avatar

Martin Vancl tuxmartin

View GitHub Profile
View add_hosts.py
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 Apr 27, 2020
IoT: ESPHome current transformer
View app.yml
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 Apr 2, 2020
Vypsani stavu IMAP kvoty
View imap_quota_check.py
import imaplib, re
import os
p = re.compile('d+')
# ---------------------------------
login="user@example.net"
password="password123"
imap_server="example.net"
imap_port=993
View docker-compose.yml
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:
View gist:d86880b14ef882f447b9b9bcf4d4a764
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
View all_google-ips.txt
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
View gist:d3fd5975bccee1441a302e76faa3d874
# 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]
View nyni.php
public function checkIfSeznam():bool
{
return $this->get('utm_source') === 'www.seznam.cz' && in_array($this->get('utm_medium'), ['sekce-z-internetu', 'z-boxiku']);
}
@tuxmartin
tuxmartin / readme.md
Created Jan 14, 2019
Nahrazeni/pridani parametru u systemd sluzby
View readme.md

Priklad: chceme zmenit hodnotu Nice pro sluzbu zabbix-agent.service

Vychozi je /lib/systemd/system/zabbix-agent.service, na ten nesahame, protoze by nam ho prepsalo apt pri aktualizaci.

Vyvorime adresar a soubor s nastavenim:

mkdir -p /etc/systemd/system/zabbix-agent.service.d
touch /etc/systemd/system/zabbix-agent.service.d/10-custom-nice.conf

Syntaxe je JMENO.service.d, tedy zabbix-agent.service.d.

@tuxmartin
tuxmartin / gist:674b220fad08b89c8328bf72b26e461c
Created Dec 18, 2018
zabbix proxy 4.0 on debian 7 x86_64
View gist:674b220fad08b89c8328bf72b26e461c
apt-get install curl sudo build-essential libsqlite3-dev libxml2-dev libsnmp-dev libcurl4-openssl-dev libpcre3-dev
groupadd zabbix
useradd -g zabbix zabbix
cd /usr/local/src/
wget https://netix.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/4.0.1/zabbix-4.0.1.tar.gz
tar xzvf zabbix-4.0.1.tar.gz
cd /usr/local/src/zabbix-4.0.1/
./configure --help
./configure -prefix=/usr --enable-proxy --enable-agent --with-openssl --with-sqlite3 --with-net-snmp --with-libcurl --with-libxml2 --enable-ipv6 --with-ssh2 --sysconfdir=/etc/zabbix --bindir=/usr/bin
make
You can’t perform that action at this time.