Skip to content

Instantly share code, notes, and snippets.

View mshafiee's full-sized avatar

Mohammad Shafiee mshafiee

View GitHub Profile
@mshafiee
mshafiee / .gitlab-ci.yml
Last active June 8, 2021 13:43
Gitlab CI Template For Cross Compile Golang Source Code
image: golang:latest
variables:
REPO_NAME: gitlab.com/***/***
before_script:
- go version
- echo $CI_BUILD_REF
- echo $CI_PROJECT_DIR
----------------------------------------
Setup Install HAProxy 1.8 on Ubuntu 16
----------------------------------------
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:vbernat/haproxy-1.8
sudo apt-get update
apt-cache policy haproxy
sudo apt install haproxy
sudo update-rc.d haproxy enable
Something like this:
+----------+ +-----------+
| |+----SSH+-->| |
| A | | B |
|+--------+| | |
Internet <-++-+PROXY<++<SSH Tunnel--+ |
|+--------+| | |
+----------+ +-----------+
[global]
; Override default pid file
pid = /run/php-fpm.pid
; Avoid logs being sent to syslog
error_log = /proc/self/fd/2
[www]
; Access from webserver container is via network, not socket file
listen = [::]:9000
# Template my.cnf for PXC
# Edit to your requirements.
[mysqld]
server-id=1
datadir=/var/lib/mysql
socket=/var/run/mysqld/mysqld.sock
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
log-bin
log_slave_updates
[mysqld]
# Path to Galera library
wsrep_provider=/usr/lib/galera3/libgalera_smm.so
# Cluster connection URL contains IPs of nodes
#If no IP is found, this implies that a new cluster needs to be created,
#in order to do that you need to bootstrap this node
wsrep_cluster_address=gcomm://172.16.10.20,172.16.20.20,172.16.30.20
# In order for Galera to work correctly binlog format should be ROW
#!/bin/bash
while IFS='' read -r line || [[ -n "$line" ]]; do
echo '' | db2struct --host localhost -d farayad --package farayad -p --user root --struct=$line -t $line --gorm --guregu
done < "$1"
usage:
1-show tables;
2-store table name in tablename.txt file.
3- run: bash mysql2go.sh tablename.txt
@mshafiee
mshafiee / nginx.conf
Created March 10, 2019 10:28
Php behind HTTPS/SSL Proxy (nginx, fastcgi)
##
# nginx server with http + ssl/https (Front)
# /etc/nginx/sites-available/example.com
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://no-ssl:8080;
proxy_set_header Host $host;
@mshafiee
mshafiee / ipsec.server.to.site
Last active August 3, 2023 16:39
Setup a Server to Site IPSec VPN with strongSwan on Ubuntu
sudo apt update && sudo apt upgrade -y
sudo apt install strongswan -y
sudo vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
sudo sysctl -p /etc/sysctl.conf
openssl rand -base64 64
@mshafiee
mshafiee / sysctl.conf
Created December 5, 2019 07:37 — forked from techgaun/sysctl.conf
Sysctl configuration for high performance
### KERNEL TUNING ###
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2