Skip to content

Instantly share code, notes, and snippets.

View sl-digital's full-sized avatar

SL Digital sl-digital

View GitHub Profile
@sl-digital
sl-digital / docker-iptables-rules.v4
Last active January 23, 2023 03:55
Docker iptables for NGINX web services and local MySQL
sudo iptables -A INPUT -i lo -j ACCEPT
sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT
sudo iptables -A INPUT -j DROP
# Allow traffic coming from docker0 interface
sudo iptables -I INPUT 6 -i docker0 -p tcp --dport 3306 -j ACCEPT
@sl-digital
sl-digital / Permissions.txt
Created September 26, 2016 16:07
Webroot File Permissions
# Let Apache be initial owner
chown -R www-data:www-data /var/www/html
# Create an admin user
adduser admin
usermod -a -G sudo admin
usermod -a -G www-data admin
# Create a deployment user
adduser deployer
@sl-digital
sl-digital / webpack.config.js
Last active August 4, 2021 01:33
Webpack Config File for Laravel/Vue
//=================================================================================
// WEBPACK MODULES
//=================================================================================
const ora = require('ora');
const path = require('path');
const webpack = require('webpack');
//=================================================================================
// WEBPACK OUTPUT PATHS
@sl-digital
sl-digital / Amazon-Linux-AMI PHP55
Last active May 24, 2021 11:03
Install Apache, MySQL and PHP 5.5 on Amazon Linux AMI
:: UPDATE YUM ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
sudo yum update -y
:: INSTALL WEBSERVER :::::::::::::::::::::::::::::::::::::::::::::::::::::::::
sudo yum install httpd24
sudo service httpd start
sudo chkconfig httpd on
chkconfig --list httpd
@sl-digital
sl-digital / Ubuntu_16.04_LAMP_Install.txt
Created April 14, 2017 16:01
Ubuntu 16.04 LAMP Install
# CREATE USERS
sudo su <enter root password>
adduser devops
usermod -aG sudo devops
# SSH KEYGEN (LOCAL)
ssh-keygen <follow prompts and save>
cat ~/.ssh/yourkey_rsa.pub <copy contents>
# SSH KEYGEN (SERVER)
@sl-digital
sl-digital / gist:854fb67f3d1bd3359a1349c8e7f9674d
Last active July 20, 2017 17:14
Vagrant: CentOS 7 MariaDB Remote Access
# VAGRANT FILE
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "forwarded_port", guest: 3306, host: 33060
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder "./webroot", "/var/www/html", create:true, owner:"apache", group:"apache"
# MYSQL BIND
Change 127.0.0.1 to 0.0.0.0
# MYSQL/MARIADB COMMAND - ONLY DO THIS FOR LOCAL DEVELOPMENT!!!
@sl-digital
sl-digital / Ubuntu_16.04_LEMP_Install.txt
Last active July 6, 2017 15:22
Ubuntu 16.04 LEMP Install
# CREATE USERS
sudo su <enter root password>
adduser devops
usermod -aG sudo devops
# SSH KEYGEN (LOCAL)
ssh-keygen <follow prompts and save>
cat ~/.ssh/yourkey_rsa.pub <copy contents>
# SSH KEYGEN (SERVER)
@sl-digital
sl-digital / radius.php
Created June 14, 2017 21:50
ElasticSearch Radius Search with Distance Sort
$lat = $this->listing->latitude;
$lon = $this->listing->longitude;
$params = [
"index" => "listings",
"body" => [
"from" => 0,
"size" => 26,
"query" => [
"bool" => [
@sl-digital
sl-digital / query_string.php
Created June 14, 2017 21:44
ElasticSearch Query String Search
$default = [
"query_string" => [
"default_operator" => "AND",
"fields" => ["name","desc","tags","city"],
"query" => $query
]
];
$filtered = [
"bool" => [
@sl-digital
sl-digital / webpack.init.js
Last active May 1, 2017 17:05
Webpack Init File for Laravel/Vue
//=================================================================================
// WEBPACK MODULES
//=================================================================================
const ora = require('ora');
const path = require('path');
const chalk = require('chalk');
const rimraf = require('rimraf')
const webpack = require('webpack');
const config = require('./webpack.config');