Skip to content

Instantly share code, notes, and snippets.

View jpbarbosa's full-sized avatar

JP Barbosa jpbarbosa

View GitHub Profile
@jpbarbosa
jpbarbosa / nginx.vhost
Last active May 22, 2016 02:30
Nginx Basic Vhost
server {
listen 80;
listen [::]:80;
root /home/forge/{{domain}}/current/public;
index index.php index.html index.htm;
server_name {{domain}} www.{{domain}};
server {
listen 81;
listen [::]:81;
root /home/forge/phpmyadmin;
index index.php index.html index.htm;
server_name _;
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
@jpbarbosa
jpbarbosa / s3sync.sh
Last active June 25, 2016 23:14
Script to backup S3 buckets based on local directories
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"
@jpbarbosa
jpbarbosa / mysqldump.sh
Created June 25, 2016 23:16
Script to backup MySQL databases based on local directories
#! /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 ""