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 / encoder.sh
Created July 14, 2016 18:11
FFMpeg Presets for HTML5 Videos
#!/bin/zsh
# USAGE: ./encoder.sh some-video.mov
# Changed the MP4 settings to work with Safari
# OGG seems to work best just using the quality scale
# WEBM is just adjusted by bitrate depending on how much motion there is
IN=$1
OUT=$(echo $1 | sed 's/^\(.*\)\.[a-zA-Z0-9]*$/\1/')
ffmpeg -i $IN -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -level 3 -movflags +faststart $OUT.mp4
@sl-digital
sl-digital / Vagrant - Ubuntu Nginx
Last active December 3, 2015 18:53
Vagrant LEMP Stack
1) Install new Vagrant box with ubuntu/trusty64
2) sudo apt-get update / upgrade
3) install NGINX
> sudo apt-get install nginx
4) install MySQL
> sudo apt-get install mysql-server-5.6
> sudo mysql_secure_installation
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>%%title%%</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
#MySQL Setup
forward port 3306 to 33060
Change binding from 127.0.0.1 to 0.0.0.0
select user,host from mysql.user where user='root';
create user 'root'@'10.0.2.2' identified by 'yourpassword';
grant all privileges on *.* to 'root'@'10.0.2.2' with grant option;
flush privileges;
sudo service mysql restart
#Setup for connecting SequelPro to the Vagrant box
#port forwarding
forward port 3306 to 33060
#my.conf
Change binding from 127.0.0.1 to 0.0.0.0
#mysql users config
select user,host from mysql.user where user='root';
/**
* Setup:
* 1) Install Node/NPM Globally (https://nodejs.org/)
* 2) Install Gulp and Gulp Modules
*
* Run these commands in Terminal after installing Node:
* 1) sudo npm install --global gulp
* 2) npm install gulp gulp-jshint gulp-sass gulp-autoprefixer gulp-minify-css gulp-uglify gulp-imagemin imagemin-pngquant gulp-rename gulp-watch gulp-notify --save-dev
**/
<?php
/*
* Template Name: AJAX Page
*
* This page template responds to the request type by serving only the content for an AJAX request
* and the content wrapped in the parent layout for a normal request. This allows for loading the
* content via AJAX and the History API without the need for hash-bang URLs.
*/
$url = rtrim($_SERVER['REQUEST_URI'],"/");
@sl-digital
sl-digital / stash.conf
Created May 26, 2015 21:01
Atlassian Stash on OSX Server
/*
* 1) Install Atalassian Stash on default port 7990
* 2) Create new website on OSX Server (http://stash.osx-server.com)
* 3) Update VHosts on OSX Server for site created above with ProxyBalancer entry
* 4) Start Stash with shell script
* 5) Check site in browser to make sure forwarding is working
*/
<IfModule mod_proxy_balancer.c>
ProxyPass / balancer://balancer-group/
@sl-digital
sl-digital / gulpfile.js
Created May 14, 2014 15:19
Basic GulpFile
//==============================================================================
// H&L GulpJS + Node - Front End Asset Management
//==============================================================================
var gulp = require("gulp"),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
jshint = require('gulp-jshint'),
concat = require('gulp-concat'),
uglify = require('gulp-uglifyjs'),