Skip to content

Instantly share code, notes, and snippets.

View mgiay's full-sized avatar
🎯
Focusing

Problem Solving On Unix/Linux Systems mgiay

🎯
Focusing
View GitHub Profile
@mgiay
mgiay / Netfilter-IPTables-Diagrams.md
Created May 13, 2022 14:25 — forked from tonicmuroq/Netfilter-IPTables-Diagrams.md
Linux NetFilter, IP Tables and Conntrack Diagrams

Linux NetFilter, IP Tables and Conntrack Diagrams

IPTABLES TABLES and CHAINS

IPTables has the following 4 built-in tables.

1) Filter Table

Filter is default table for iptables. So, if you don’t define you own table, you’ll be using filter table. Iptables’s filter table has the following built-in chains.

@mgiay
mgiay / run-xtrabackup.sh
Created November 2, 2021 06:18 — forked from jmfederico/run-xtrabackup.sh
Script to create full/incremental backups with xtrabackup.
#!/bin/sh
TMPFILE="/tmp/xtrabackup-runner.$$.tmp"
USEROPTIONS="--user=${MYSQL_USER} --password=${MYSQL_PASSWORD} --host=${MYSQL_HOST}"
BACKDIR=/srv/mysql-bak
BASEBACKDIR=$BACKDIR/base
INCRBACKDIR=$BACKDIR/incr
FULLBACKUPCYCLE=604800 # Create a new full backup every X seconds
KEEP=1 # Number of additional backups cycles a backup should kept for.
START=`date +%s`
@mgiay
mgiay / haproxy-cors.md
Created March 23, 2021 07:56 — forked from nasrulhazim/haproxy-cors.md
Setting Up CORS in HAProxy
frontend localnodes
    bind *:80
    reqadd X-Forwarded-Proto:\ http

    # Add CORS headers when Origin header is present
    capture request header origin len 128
    http-response add-header Access-Control-Allow-Origin %[capture.req.hdr(0)] if { capture.req.hdr(0) -m found }
    rspadd Access-Control-Allow-Methods:\ GET,\ HEAD,\ OPTIONS,\ POST,\ PUT  if { capture.req.hdr(0) -m found }
    rspadd Access-Control-Allow-Credentials:\ true  if { capture.req.hdr(0) -m found }
@mgiay
mgiay / nginx.conf
Created February 9, 2021 10:24 — forked from kmjones1979/nginx.conf
Example NGINX configuration to route based on country code using GeoIP
# load dynamic modules
load_module /etc/nginx/modules/ngx_http_geoip_module.so;
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events { worker_connections 1024; }
http {
description keywords title
remitano
remitano, bitcoin, ethereum
remitano

What is remitano ?

It provides escrowed P2P Tether USDT marketplace where people buy and sell Tether USDT easily and safely with notable simple UI, friendly online customer support 24/7 and lowest fee compared with major players on the market.

@mgiay
mgiay / blog20181001-01.cfg
Created October 21, 2020 05:23 — forked from haproxytechblog/blog20181001-01.cfg
Using HAProxy as an API Gateway, Part 1
frontend api_gateway
bind :443 ssl crt /etc/hapee-1.8/certs/cert.pem
acl PATH_cart path_beg -i /cart
acl PATH_catalog path_beg -i /catalog
use_backend be_cart if PATH_cart
use_backend be_catalog if PATH_catalog
backend be_cart
server s1 10.0.0.3:80
@mgiay
mgiay / Haprox2.0 standalone
Created June 11, 2020 04:40 — forked from thyn/Haprox2.0 standalone
Compile OpenSSL 1.0.2 and HAProxy from the source on CentOS 7
# Compile and install HAProxy
rm -rf /tmp/haproxy-current
git clone http://git.haproxy.org/git/haproxy-2.0.git /tmp/haproxy-current
cd /tmp/haproxy-current
make \
TARGET=linux-glibc USE_LINUX_TPROXY=1 USE_ZLIB=1 USE_REGPARM=1 USE_PCRE=1 USE_PCRE_JIT=1 \
USE_OPENSSL=1 SSL_INC=/usr/include SSL_LIB=/usr/lib ADDLIB=-lpthread USE_SYSTEMD=1 \
CFLAGS="-O2 -g -fno-strict-aliasing -DTCP_USER_TIMEOUT=18"
make install
# cp /tmp/haproxy-current/examples/haproxy.init /etc/init.d/haproxy
frontend http-in-ext
bind 0.0.0.0:80
bind 0.0.0.0:443 ssl crt /SSL/yourcert.pem
option forwardfor
reqrep (.*)/seamedia/(.*) \1/seahub/seamedia/\2
acl path_seahub path_beg /seahub
acl path_seafile path_beg /seafhttp
#Force https
@mgiay
mgiay / postgres_queries_and_commands.sql
Created July 11, 2019 01:41 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@mgiay
mgiay / iptables-persistent no input
Created June 5, 2019 04:08 — forked from alonisser/iptables-persistent no input
Installing iptables-persistent on ubuntu without manual input
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections
sudo apt-get -y install iptables-persistent