Skip to content

Instantly share code, notes, and snippets.

View gonzalo-trenco's full-sized avatar
🔥

Gonzalo Trenco gonzalo-trenco

🔥
View GitHub Profile
@gonzalo-trenco
gonzalo-trenco / copyToVagrant.sh
Created August 13, 2018 08:21
Copy file from local to vagrant VM
#!/bin/sh
OPTIONS=`vagrant ssh-config | tail -n +2 | awk -v ORS=' ' '{print "-o " $1 "=" $2}'`
scp ${OPTIONS} /File/To/Copy vagrant@YourServer:/Where/To/Put/File
@gonzalo-trenco
gonzalo-trenco / clean.sh
Created August 10, 2018 07:13
Clean releases directories over 4 days old
#!/bin/bash
# releases should be name after formatted timestamp
# date "+%Y%m%d%H%M%S" in order to work
time_margin=$(date -d "4 days ago" "+%Y%m%d%H%M%S")
for i in $( ls releases ); do
if [ "$time_margin" -gt "$i" ]; then
echo "$i will be removed"
rm -rf releases/$i
@gonzalo-trenco
gonzalo-trenco / centos_iptables_setup.sh
Created May 26, 2017 08:01
CentOS iptables setup for common webserver
#!/usr/bin/env bash
## IPTABLES SETUP
iptables -F;
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP;
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP;
iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP;
@gonzalo-trenco
gonzalo-trenco / setFileType.js
Last active May 26, 2017 08:33
function to override FileReader API object type property
function setFileType(file, type) {
Object.defineProperties(file, {
'type': {
writable: true
}
});
file.type = type;
return file;
}