Skip to content

Instantly share code, notes, and snippets.

gonzalo-trenco / setFileType.js
Last active May 26, 2017
function to override FileReader API object type property
View setFileType.js
function setFileType(file, type) {
Object.defineProperties(file, {
'type': {
writable: true
file.type = type;
return file;
gonzalo-trenco /
Created May 26, 2017
CentOS iptables setup for common webserver
#!/usr/bin/env bash
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 /
Created Aug 10, 2018
Clean releases directories over 4 days old
# 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 /
Created Aug 13, 2018
Copy file from local to vagrant VM
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
You can’t perform that action at this time.