Skip to content

Instantly share code, notes, and snippets.

@hatan4ik
hatan4ik / Windows 10 Optimization Script.ps1
Created April 3, 2020 12:33
Windows 10 Optimization Script
##########
# Win10 Optimization Script With Extra GPD Win Tweaks
# Adapted version of https://github.com/Disassembler0/Win10-Initial-Setup-Script by Disassembler <[email protected]>
# Author: BlackDragonBE
# Version: v2.2.1 (2017-12-02)
# Copied from https://www.reddit.com/r/gpdwin/comments/6ipa6c/windows_10_optimization_script_for_gpd_win/
##########
# As a workaround for disabled script execution, run this command (without #) in an elevated PowerShell windows first and choose "all" if you're asked where to apply this:
# Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
@hatan4ik
hatan4ik / nginx-tuning.md
Created March 26, 2019 13:20 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@hatan4ik
hatan4ik / dnscheck
Created January 24, 2019 20:34 — forked from antonlindstrom/dnscheck
keepalived for DNS
#!/bin/bash
#$Id: keepalivepin,v 1.2 2006/02/27 07:30:41 hmy Exp hmy $
#use dig check the powerdns's status.
#in the dns database,have a IN TXT RR keepalivepin.vmmatrix.net,content is "AaBbCcDdEeFf"
# Source: http://puppet-manifest-share.googlecode.com/svn/trunk/vmx-puppet/modules/lvs/files/keepalived.dns-pin
#
RR=keepalivepin.vmmatrix.net
[ $# -le 1 ]&&{ echo "usage: ${0} -h <ip>"; exit 126;}
while getopts "h:" OPT;do
case $OPT in
#!/bin/sh
VIP=$1
IF=$2
# Determine the interface's MAC address
MAC=`ip link show $IF | awk '/ether/ {print $2}'`
# Determine ENI ID of the interface
ENI_ID=`curl http://169.254.169.254/latest/meta-data/network/interfaces/macs/$MAC/interface-id`
@hatan4ik
hatan4ik / mysql_rotate_large_table.sql
Created January 24, 2019 20:33 — forked from kesor/mysql_rotate_large_table.sql
Rotate huge tables to old_tablename without affecting continued writes to these tables and keeping existing indexes and auto_increment counters.
DROP PROCEDURE IF EXISTS rotateAudit;
delimiter ;;
CREATE PROCEDURE rotateAudit(
pv_database VARCHAR(64),
pv_table VARCHAR(64)
)
BEGIN
SET @createDbStatement := CONCAT('CREATE DATABASE IF NOT EXISTS archive_',pv_database);
SET @createStatement := CONCAT('CREATE TABLE ',pv_database,'.new_',pv_table,' LIKE ',pv_database,'.',pv_table);
SET @insertStatement := CONCAT('INSERT INTO ',pv_database,'.new_',pv_table,' SELECT * FROM ',pv_database,'.',pv_table,' ORDER BY id DESC LIMIT 50000');
@hatan4ik
hatan4ik / gist:127f689e9089ec206b0c030dd936cea2
Created January 24, 2019 20:32
Ansible timezone for CentOS
---
- name: Check current timezone
shell: awk -F\" '{ print $2}' /etc/sysconfig/clock
register: current_zone
changed_when: False
- name: Set UTC timezone
file: src=/usr/share/zoneinfo/{{ timezone }} dest=/etc/localtime state=link force=yes
when: current_zone.stdout != '{{ timezone }}'
@hatan4ik
hatan4ik / installHAProxy.sh
Created January 24, 2019 20:32 — forked from emgee3/installHAProxy.sh
Install HAProxy in Ubuntu 14.04 or 12.04
#!/usr/bin/env bash
#
# Install HAProxy
# Script works on Ubuntu 12.04 and 14.04 only
set -e
set -u
set -o pipefail
@hatan4ik
hatan4ik / docker_workshop_microservices_cheat_sheet.md
Created January 24, 2019 20:32 — forked from kesor/docker_workshop_microservices_cheat_sheet.md
docker workshop cheat sheet #2 - microservices
@hatan4ik
hatan4ik / jenkins_backup.sh
Created January 24, 2019 20:31 — forked from toddlers/jenkins_backup.sh
Jenkins_Bacup via jenkins
# Delete all files in the workspace
rm -rf *
# Create a directory for the job definitions
mkdir -p $BUILD_ID/jobs
# Copy global configuration files into the workspace
cp $JENKINS_HOME/*.xml $BUILD_ID/
# Copy keys and secrets into the workspace
cp $JENKINS_HOME/identity.key.enc $BUILD_ID/
root@89de118f2aa3:~# ps -ef ; date ; nohup ./zombie & ; sleep 2 ; ps -ef ; sleep 65 ; date ; ps -ef
bash: syntax error near unexpected token `;'
root@89de118f2aa3:~# ps -ef ; date ; (nohup ./zombie &) ; sleep 2 ; ps -ef ; sleep 65 ; date ; ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 16:41 ? 00:00:00 /bin/bash
root 364 1 0 16:47 ? 00:00:00 ps -ef
Wed May 20 16:47:37 UTC 2015
nohup: appending output to 'nohup.out'
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 16:41 ? 00:00:00 /bin/bash