Skip to content

Instantly share code, notes, and snippets.

@arx76
arx76 / clone-mysql-db.sh
Created April 25, 2020 14:29 — forked from csonuryilmaz/clone-mysql-db.sh
Clone a MySQL database to a new database on the same server without using a dump file. This is much faster than using mysqldump.
#!/bin/bash
DBUSER="root";
DBPASS="";
DBHOST="localhost";
DB_OLD=mydatabase
DB_NEW=clone_mydatabase
DBCONN="--host=${DBHOST} --user=${DBUSER} --password=${DBPASS}";
@arx76
arx76 / magento-nginx.conf
Created June 13, 2019 05:51 — forked from gwillem/magento-nginx.conf
Battle-tested Nginx configuration for Magento (source: www.hypernode.com)
# This is an annotated subset of the Nginx configuration from our Magento production platform @ www.hypernode.com
# See https://www.byte.nl/blog/magento-cacheleak-issue
# !!!! If you are a Hypernode customer, do not use this config as it will result in duplicate statements. !!!!!
user app;
worker_processes 4;
pid /var/run/nginx.pid;
events {
// stove ver 110
#include <Adafruit_MAX31855.h>
#include <LiquidCrystal.h>
#include <Servo.h>
#include <PID_v1.h>
// define integers
int x = 0;
int setBeepBuzzer= 1;
int muteBuzzer = LOW;
location / {
root {DOCROOT}public
if ($scheme != "https") {
rewrite ^ https://$http_host$request_uri? permanent;
}
try_files /public/$uri /public/$uri/ /public/index.php?$query_string;
}
@arx76
arx76 / backup-to-s3.sh
Created February 7, 2019 19:47 — forked from MikeRogers0/backup-to-s3.sh
A method of backing up your website to Amazon S3.
#!/bin/bash
## Email Variables
EMAILDATE=`date --date="today" +%y-%m-%d`
EMAIL="[email protected]"
SUBJECT="[servername] Backup Script Started! - "$EMAILDATE
EMAILMESSAGE="/tmp/emailmessage1.txt"
echo "Just to let you know that the backup script has started."> $EMAILMESSAGE
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
@arx76
arx76 / ansible_semaphore_ubuntu.md
Created December 13, 2018 12:31 — forked from thedumbtechguy/ansible_semaphore_ubuntu.md
Install Ansible Semaphore on Ubuntu

Ansible Installation

Ansible is a powerful configuration management tool that we use in managing our infrastructure and applications.

It requires a centralized Control server and can connect to hosts over an array of connection types including SSH.

Controller Setup

The Ansible controller will run our playbooks. This needs both Ansible and Semaphore (web based management console) setup.

@arx76
arx76 / Script_Template.ps1
Created December 6, 2018 12:13 — forked from 9to5IT/Script_Template.ps1
PowerShell: Script Template
#requires -version 2
<#
.SYNOPSIS
<Overview of script>
.DESCRIPTION
<Brief description of script>
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
Established connections number
ss -p | grep nginx | grep -i estab | wc -l
Established connections IP addresses
ss -p | grep nginx | grep -i estab | awk '{print $6}' | cut -f1 -d\: | sort -u
@arx76
arx76 / gist:613c543f88fbf840b1a9d7402b2d8561
Created November 29, 2018 15:00 — forked from loisaidasam/gist:2774350
One liner for counting unique IP addresses from nginx logs
# One liner for counting unique IP addresses from nginx logs
# Feel free to comment with better ideas - I'm sure it's not the best way of doing this (I'm no awk ninja!)
#
# Sample output:
#
# $ cat example.com.access.log | awk -F " " '{a[$1]++ } END { for (b in a) { print b, "\t", a[b] } }'
# 66.65.145.220 49
# 92.63.28.68 126
cat example.com.access.log | awk -F " " '{a[$1]++ } END { for (b in a) { print b, "\t", a[b] } }'
@arx76
arx76 / ISPConfig + Laravel
Created November 29, 2018 14:39 — forked from deyvsonaguiar/ISPConfig + Laravel
Diretiva Nginx para usar Laravel e ISPConfig3
location = /robots.txt {
root {DOCROOT}public;
access_log off;
log_not_found off;
allow all;
}
location / {
root {DOCROOT}public;
try_files $uri $uri/ /index.php?q=$uri&$args;