Skip to content

Instantly share code, notes, and snippets.

View demofly's full-sized avatar

Stanislav O. demofly

View GitHub Profile
@demofly
demofly / vsftpd.conf
Created April 8, 2020 09:40
VSFTPd config for Astra repos
# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
@demofly
demofly / GLB.sh
Created April 10, 2018 21:04
How to attach your GKE NodePort nginx-service to a precreated GLB
#!/bin/bash
#set -x
## Predefined variables ##
#export GCP_CI_SVC_ACCOUNT=$(base64 my-svc-account-gcp.json)
#export GCP_CI_SVC_ACCOUNT_ID=my-svc-account-gcp-id@....google.com
export CLOUDSDK_CORE_DISABLE_PROMPTS=1
export CI_DOMAIN="ci.domain.tld"
@demofly
demofly / get-k8s-node-ip-addresses.sh
Created March 22, 2018 22:02 — forked from rkuzsma/get-k8s-node-ip-addresses.sh
Get external IP address of Kubernetes nodes
#!/bin/bash
kubectl get nodes --selector=kubernetes.io/role!=master -o jsonpath={.items[*].status.addresses[?\(@.type==\"ExternalIP\"\)].address}
@demofly
demofly / bitbucket-pipelines.yml
Created February 21, 2018 20:11 — forked from adilsoncarvalho/bitbucket-pipelines.yml
Bitbucket Pipelines deployment to a Google Container Engine configuration
---
options:
docker: true
pipelines:
branches:
master:
- step:
script:
# Installing gcloud
@demofly
demofly / reclaimWindows10.ps1
Created January 7, 2018 20:00 — forked from alirobe/reclaimWindows10.ps1
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults)
##########
# Tweaked Win10 Initial Setup Script
# Primary Author: Disassembler <disassembler@dasm.cz>
# Modified by: alirobe <alirobe@alirobe.com> based on my personal preferences.
# Version: 2.10.1, 2017-11-25
# Primary Author Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script
# Tweaked Source: https://gist.github.com/alirobe/7f3b34ad89a159e6daa1/
# Tweak difference:
#
# @alirobe's version is a subset focused on safely disabling telemetry, 'smart' features, and 3rd party bloat ...
@demofly
demofly / 20130416-todo.md
Created August 5, 2017 10:08 — 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)
@demofly
demofly / recover-mtime-dates-from-git.sh
Last active November 3, 2016 16:00
How to recover mtime dates from git log: recover-mtime-dates-from-git.sh
#!/bin/bash
git ls-tree `git rev-parse HEAD` -rt --full-tree | sed -r 's#\w+ \w+ \w+\s+##' | while read FILE
do
TIME=$(git log --pretty=format:%cd -n 1 --date=iso "$FILE" 2>/dev/null)
test -z "$TIME" && continue
# TIME2=`echo $TIME | sed 's/-//g;s/ //;s/://;s/:/\./;s/ .*//'`
echo "$FILE"
# echo -n " - old mtime: "
@demofly
demofly / postgresql-drop-unused-indexes.sh
Created September 27, 2016 11:50
postgresql-drop-unused-indexes.sh
#!/bin/bash
# Written by demofly for Pg 9.4
#
# WARNING: if you ran pg_stat_reset() last month, don't use this script !!!
#
# Get unused indexes and kill it with fire!
DB=postgres
@demofly
demofly / rabbit-backup.sh
Last active September 15, 2016 21:09
/root/scripts/rabbit-backup.sh
#!/bin/bash
DT=`date +'%Y%m%d-%H%M%S'`
BKPDIR=/var/backups/rabbitmq
BKPSYMLINK="${BKPDIR}/current"
BKPFILE="${BKPDIR}/rabbitmq.config.${DT}"
test -d "${BKPDIR}" || mkdir -pv "${BKPDIR}"
ln -sfv `find /var/lib/rabbitmq/mnesia/ -name rabbitmqadmin | head -n1` /usr/local/bin/
# Outbound UDP Flood protection in a user defined chain.
iptables -N udp-flood
iptables -A OUTPUT -p udp -j udp-flood
iptables -A udp-flood -p udp -m limit --limit 50/s -j RETURN
iptables -A udp-flood -j LOG --log-level 4 --log-prefix 'UDP-flood attempt: '
iptables -A udp-flood -j DROP