Skip to content

Instantly share code, notes, and snippets.

@dubcl
dubcl / kafka-export.sh
Created August 22, 2018 23:21
Kafka enable JMX and set java heap
export JMX_PORT=${JMX_PORT:-9999}
export KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT -Dcom.sun.management.jmxremote.port=$JMX_PORT -Dcom.sun.management.jmxremote=true -Djava.rmi.server.hostname=<IP ADDRESS> -Djava.net.preferIPv4Stack=true"
export KAFKA_HEAP_OPTS="-Xmx6G -Xms6G"
@dubcl
dubcl / purge-binlog.sql
Last active July 21, 2020 20:20
Purge MySQL / MariaDB binary logs
PURGE BINARY LOGS BEFORE '2050-01-01 00:00:00';
@dubcl
dubcl / multipath_ibm_v3700.conf
Created August 14, 2018 19:59
Multipath IBM v3700 Config
device {
vendor "IBM "
product "2145"
path_grouping_policy group_by_prio
prio_callout "/sbin/mpath_prio_alua /dev/%n"
features "1 queue_if_no_path"
path_checker tur
}
@dubcl
dubcl / goha.sh
Created July 5, 2018 14:18
Goaccess for Haproxy
goaccess -f haproxy.log --log-format='%^ %^ %^:%^:%^ %^ %^[%^]: %h:%^ [%d:%t.%^] %^ %^ %^/%^/%^/%^/%L %s %b %^ %^ %^ %^/%^/%^/%^/%^ %^/%^ "%r"' --date-format='%d/%b/%Y' --time-format='%H:%M:%S' -q -a > /tmp/ha-output.html
@dubcl
dubcl / vhost.conf
Created June 11, 2018 20:47
Apache don't log
<VirtualHost *:80>
ServerName www.mywebsite.com
DocumentRoot /home/www/mywebsite
...
SetEnvIf Request_URI "(.*)foo(.*)" dontlog
CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined env=!dontlog
</VirtualHost>
@dubcl
dubcl / app.services
Created June 8, 2018 20:42
Systemd app service config Spring Boot
[Unit]
Description=A Spring Boot application
After=syslog.target
[Service]
User=baeldung
ExecStart=/path/to/your-app.jar SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
@dubcl
dubcl / postman_vars.json
Created May 17, 2018 20:17
Use variables in Postman
var jsonData = JSON.parse(responseBody);
postman.setEnvironmentVariable("session_id", jsonData.session_id);
postman.setEnvironmentVariable("audit", jsonData.audit);
@dubcl
dubcl / my.cnf
Created May 17, 2018 16:24
Percona cluster config
[mysqld]
## General
user=mysql
datadir=/var/lib/mysql
pid-file = /var/run/mysqld/mysqld.pid
log_bin_trust_function_creators=1
# SAFETY #
max-allowed-packet = 16M
max-connect-errors = 1000000
group_concat_max_len = 10000000
@dubcl
dubcl / c7-disable-selinux.sh
Created May 14, 2018 16:03
Disable CentOS 7 selinux
# Disable temporarily
echo 0 > /selinux/enforce
# Or
setenforce 0
# Or
setenforce Permissive
# Disable SELinux Permanently
vim /etc/sysconfig/selinux
@dubcl
dubcl / c7-disable-fw.sh
Created May 9, 2018 18:33
Disable CentOS 7 firewall
systemctl disable firewalld
systemctl stop firewalld