Skip to content

Instantly share code, notes, and snippets.

@jpbarbosa
jpbarbosa / mysqldump.sh
Created Jun 25, 2016
Script to backup MySQL databases based on local directories
View mysqldump.sh
#! /bin/bash
# To run: sh mysqldump.sh 2>&1 | tee "mysqldump_$(date +"%F_%T").log"
TIMESTAMP=$(date +"%F")
echo "Script to backup MySQL databases based on local directories"
echo "-----------------------------------------------------------"
echo ""
@jpbarbosa
jpbarbosa / s3sync.sh
Last active Jun 25, 2016
Script to backup S3 buckets based on local directories
View s3sync.sh
echo "Script to backup S3 buckets based on local directories"
echo "------------------------------------------------------------"
echo ""
for d in */ ; do
SECONDS=0
BUCKET=`echo $d | sed 's/.$//'`
echo "------------------------------------------------------------"
echo "Bucket: $BUCKET"
source "$d.env"
View cs-read-document
var exec = require('child_process').exec;
exports.handler = function(event, context) {
cmd = "" +
"export CS_HOME=/var/task/cloud-search-tools/;" +
"export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.77-0.b03.9.amzn1.x86_64/jre;" +
"curl -s -o /tmp/input.file " + event.url + ";" +
"cloud-search-tools/bin/cs-import-documents --source /tmp/input.file --output /tmp > /dev/null;" +
"cat /tmp/1.json";
child = exec(cmd, function(error, stdout, stderr) {
// Resolve with result of process
View phpmyadmin.nginx
server {
listen 81;
listen [::]:81;
root /home/forge/phpmyadmin;
index index.php index.html index.htm;
server_name _;
@jpbarbosa
jpbarbosa / nginx.vhost
Last active May 22, 2016
Nginx Basic Vhost
View nginx.vhost
server {
listen 80;
listen [::]:80;
root /home/forge/{{domain}}/current/public;
index index.php index.html index.htm;
server_name {{domain}} www.{{domain}};