Skip to content

Instantly share code, notes, and snippets.

View fitz123's full-sized avatar

Anton Lugovoi fitz123

View GitHub Profile
@fitz123
fitz123 / netspeed.sh
Last active February 24, 2017 16:33 — forked from joemiller/netpps.sh
#!/bin/bash
sleep_time="${1:-1}"
while read int; do
let "rx_bytes0+=$(<${int}statistics/rx_bytes)"
let "tx_bytes0+=$(<${int}statistics/tx_bytes)"
done < <(ls -d /sys/class/net/*/)
sleep $sleep_time
@fitz123
fitz123 / sed\awk tips
Last active August 29, 2015 14:24
Find all files video type
# find files of specific type
find /mnt/Private/YandexDisk/photos -type f -exec file -N -i -- {} + | sed -n 's!: video/[^:]*$!!p'
# exclude regex "127.0.*" from 4th column, "[ut][dc]p6" from 1st column, and exclude 2nd column 2 times
netstat -tulpan | awk '$4!~"127.0."' | awk '$1!~"[ut][dc]p6"' | sed -r 's/(\s+)?\S+//2' | sed -r 's/(\s+)?\S+//2'
@fitz123
fitz123 / elastic_bulk-import-settings.sh
Last active October 8, 2024 02:00
Elastic | Performance tuning for big data import
##
# Temporary Speed-up configuration for fast import
# references: https://www.elastic.co/blog/performance-considerations-elasticsearch-indexing
# p.s. If you do not want to restart your node/cluster - don't perform 1 and 2 points
##
# 1. Change "ES_HEAP_SIZE" from 50% of memory (default and recommended) to something like 80%
mem=`free -m | grep Mem | awk '{ print $2 }'` && heap=$[ ($mem/1024)*80/100 ]g && \
sudo sed -i "s/ES_HEAP_SIZE=.*/ES_HEAP_SIZE=$heap/" /etc/init.d/elasticsearch
@fitz123
fitz123 / elastic_metrics-docs-per-sec.sh
Last active September 10, 2015 10:55
Elastic | Easy way to measure new docs per second
# Do you tried to measure how many new docs appear in your ES by refreshing Kibana?
# Do you research how to measure ES performance and find nothing suitable for you?
# I found that approach usefull
while true; do \
count1=`curl -s -XGET 'http://localhost:9200/_count?q=tags:imported&filter_path=count' | egrep -o '[0-9]+'` && \
sleep 125 && \
count2=`curl -s -XGET 'http://localhost:9200/_count?q=tags:imported&filter_path=count' | egrep -o '[0-9]+'` && \
echo `date +%T` - $[ ($count2 - $count1)/125 ] docs/sec; done
@fitz123
fitz123 / Security recommendations for Windows users.md
Last active December 2, 2022 15:02
Security recommendation for Windows users

Security recommendations for Windows users

Chapter 1: Basic OS protections

  1. Change(or create) password for current user:
    1. ctrl+alt+del --> Change password
  2. Create non-admin user and sign in into the system as non-admin only:
  3. Open Run prompt: ctrl+R
@fitz123
fitz123 / OpenVPN Windows client installation.md
Last active August 29, 2024 12:30
OpenVPN Windows client installation

OpenVPN Windows client installation

To get access to internal network VPN connection is nessessary

To setup and run VPN access user have to have Administrator rights, to avoid that we'll perform all installation steps as Administrator but configure service to be usable for all system users

Manual setup VPN connection to be activated automatically as a service during PC start. If you want to change that behavior - disable the service and use "OpenVPN GUI" app as Administrator

  1. Get a configuration archive from trusted source
  2. Login to a system as Administrator
@fitz123
fitz123 / reboot_required_check.sh
Last active December 9, 2015 18:34
Zabbix monitoring script | Checking urgency in changelog for updates which require system restart
#!/bin/bash
##################################
# Zabbix monitoring script
#
# Checking urgency in changelog
# for updates which require system restart
#
# https://gist.githubusercontent.com/fitz123/6e0e127a336d96ca4c42/raw/be5275f6fb3869c6cce9d3fbb9c2727cad3df63a/reboot_required_check.sh
#
##################################
@fitz123
fitz123 / nginx_response_codes_count.sh
Last active December 10, 2015 11:47
Zabbix monitoring script | Nginx response codes count using elasticsearch database
#!/bin/bash
##################################
# Zabbix monitoring script
#
# Nginx response codes count
# using elasticsearch database
#
# https://gist.githubusercontent.com/fitz123/433561fac586713685cd/raw/9a6b7eb6704b9a1ec270673f2997105c4a95ff0c/nginx_response_codes_count.sh
#
##################################
@fitz123
fitz123 / naxsi_rate.sh
Last active December 10, 2015 12:41
Naxsi rate using elasticsearch database
#!/bin/bash
##################################
# Zabbix monitoring script
#
# Naxsi rate using elasticsearch database
#
# https://gist.github.com/fitz123/6d8e03e8c287a6988553
#
##################################
# Contact:
@fitz123
fitz123 / source.list
Created January 18, 2016 20:00
ubuntu source.list
#
# deb cdrom:[Ubuntu-Server 14.04.3 LTS _Trusty Tahr_ - Beta amd64 (20150805)]/ trusty main restricted
# deb cdrom:[Ubuntu-Server 14.04.3 LTS _Trusty Tahr_ - Beta amd64 (20150805)]/ trusty main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.