Skip to content

Instantly share code, notes, and snippets.

View krasnuydyx's full-sized avatar

Andrii Danyliuk krasnuydyx

View GitHub Profile
@krasnuydyx
krasnuydyx / centos_utorrent_setup.sh
Last active October 21, 2016 14:21 — forked from integrii/setup.sh
uTorrent Server (utserver) on Centos 7 (x86_64)
#!/bin/bash
# Took me awhile to figure out how to install utserver on Centos 7 x86_64... Especially with the new systemd subsystem. None of the builds I saw support it - but it will work with a couple symlinks and compatibility packages.
yum install glibc libgcc openssl krb5-libs libcom_err zlib keyutils-libs libselinux glibc glibc.i[36]86 libgcc libgcc.i[36]86 openssl openssl.i[36]86 krb5-libs krb5-libs.i[36]86 libcom_err libcom_err.i[36]86 zlib zlib.i[36]86 keyutils-libs keyutils-libs.i[36]86 libselinux libselinux.i[36]86 openssl098e-0.9.8e-29.el7.centos.2.i686 -y
ln -s /usr/lib/libssl.so.0.9.8e /lib/libssl.so.0.9.8
ln -s /usr/lib/libcrypto.so.0.9.8e /lib/libcrypto.so.0.9.8
mkdir /var/utserver
wget -O /var/utserver/utorrent-server-3.0-25053.tar.gz http://download.utorrent.com/linux/utorrent-server-3.0-25053.tar.gz
cd /var/utserver/
tar zxf utorrent-server-3.0-25053.tar.gz
mv /var/utserver/utorrent-server-v3_0/* /var/utserver/
@krasnuydyx
krasnuydyx / aws-s3-delete.sh
Last active November 22, 2017 14:00
AWS S3 console upload/download/delete
S3KEY=""
BUCKET=""
REGION="s3"
S3SECRET=""
file=$1
resource="/${BUCKET}/${file}"
contentType="application/x-compressed-tar"
dateValue=`date -R`
stringToSign="DELETE\n\n${contentType}\n${dateValue}\n${resource}"
@krasnuydyx
krasnuydyx / proxy.pac
Created October 10, 2016 09:48
Auto proxy configuration for mac
function FindProxyForURL(url, host) {
PROXY = "PROXY 1.2.3.4"
// Apple.com via proxy
if (shExpMatch(host,"*.apple.com")) {
return PROXY;
}
// Everything else directly!
return "DIRECT";
}
@krasnuydyx
krasnuydyx / new_site.sh
Last active September 16, 2017 14:38
create wordpress site
#!/usr/bin/env bash
echo "Enter domain name:"
read domain_name
domain=`echo ${domain_name} | cut -d "." -f 1`
echo "Enter mysql pass:"
read mysql_pass
echo "Enter admin user name:"
#!/usr/bin/env bash
function status {
docker inspect $1 | grep Status | awk '{print $2}'
}
cont="nginx-srv registry-web registry-srv"
get_regex="^.*running.*$"
for i in $cont
@krasnuydyx
krasnuydyx / nginx.conf
Last active November 22, 2017 13:59
Nginx.conf optimized for magento
user nginx nginx;
worker_processes auto;
worker_rlimit_nofile 8192;
events {
worker_connections 8000;
}
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
http {
@krasnuydyx
krasnuydyx / httpd.conf
Last active November 22, 2017 13:58
apache-magento
Header set Set-Cookie HttpOnly;Secure
Header set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
Header always set X-XSS-Protection "1; mode=block"
#Header always append X-Frame-Options SAMEORIGIN
Header always set X-Content-Type-Options: nosniff
#Header set Pragma "no-cache"
#Header set Expires 0
<IfModule mpm_worker_module>
ServerLimit 24
@krasnuydyx
krasnuydyx / vfc.vcl
Created December 7, 2017 13:43
Varnish block ip
acl forbidden {
"10.10.10.10";
}
sub vcl_recv {
if (client.ip ~ forbidden) {
error 403 "Forbidden";
}
}
@krasnuydyx
krasnuydyx / sysctl.conf
Created December 26, 2017 14:53
System optimization for 1-10G networks, tested on AWS
net.core.rmem_max = 11960320
net.core.wmem_max = 11960320
net.ipv4.tcp_rmem = 4096 524288 11960320
net.ipv4.tcp_wmem = 4096 524288 11960320
net.core.netdev_max_backlog = 30000
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_congestion_control = cubic
net.ipv4.tcp_window_scaling =1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_sack = 1
@krasnuydyx
krasnuydyx / mysql_size.sh
Last active August 19, 2020 23:25
List sizes of MySQL databases
# Database size
SELECT
table_schema AS "Database name",
SUM(data_length + index_length) / 1024 / 1024 AS "Size (MB)"
FROM information_schema.TABLES
GROUP BY table_schema;
# Database and index sizes
SELECT SUM(Data_length)/1024/1024/1024,SUM(Index_length)/1024/1024/1024 FROM information_schema.tables;
# WHERE table_schema = '';