Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
S3_BUCKET_NAME="${1?Missing 1st argument bucket Name}"
S3_KEY="${2?Missing 2nd argument bucket key}"
FILE_PATH="${3?Missing 3rd argument file path}"
formated_date=`date -R`
content_type="application/octet-stream"
curl -v -X PUT -T ${FILE_PATH} \
-H "Host: ${S3_BUCKET_NAME}.s3.amazonaws.com" \
-H "Date: ${formated_date}" \
-H "Content-Type: ${content_type}" \
@facundovictor
facundovictor / destructuring.js
Created December 12, 2018 22:57 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@facundovictor
facundovictor / terraform-provider-aws-builder-Dockerfile
Created March 29, 2018 03:02
Dockerfile used for building the AWS terraform provider --> https://www.terraform.io/docs/providers/aws/
FROM centos:7.4.1708
RUN yum install -y -q which vim wget git zip unzip gzip cmake make
ENV GOPATH=/opt/golang
WORKDIR $GOPATH
# Go references:
# https://golang.org/doc/install
# https://golang.org/cmd/go/#hdr-GOPATH_environment_variable
@facundovictor
facundovictor / vpn_clear.sh
Last active November 20, 2017 13:11
openconnect scripts
#!/usr/bin/env bash
# References:
# https://github.com/dnschneid/crouton/wiki/Using-Cisco-AnyConnect-VPN-with-openconnect
# http://tuxdiary.com/2014/09/04/cisco-anyconnect-vpn-with-openvpn-openconnect/
INTERFACE=tun1
# Clear the tun interface
ifconfig $INTERFACE down
@facundovictor
facundovictor / tunnel.sh
Last active June 19, 2017 01:23
Easy VPN through SSH
#!/bin/bash
LOCAL_PORT=8080
REMOTE_SERVER=destination.server
REMOTE_USER=user
ssh -D $LOCAL_PORT -f -C -q -N $REMOTE_USER@$REMOTE_SERVER
@facundovictor
facundovictor / config.yml
Created May 17, 2017 00:17
Parse YAML from bash with sed and awk.
development:
adapter: mysql2
encoding: utf8
database: my_database
username: root
password:
apt:
- somepackage
- anotherpackage
@facundovictor
facundovictor / record
Last active May 12, 2017 01:40
Recording screen with ffmpeg
#!/usr/bin/env bash
#
# References:
# - https://trac.ffmpeg.org/wiki/Capture/Desktop
###############################################################################
# -s[:stream_specifier] size
# Better option : -video_size size
RESOLUTION="1366x768"
@facundovictor
facundovictor / Javascript-features.js
Last active July 21, 2016 20:11
This is a practical resume of some JavaScript specifications
/*
@author: Facundo Victor <[email protected]>
_____________________________________________
Using Prototype
__proto__ is the actual object that is used in the lookup chain to resolve
methods, etc. prototype is the object that is used to build __proto__ when
you create an object with new:
*/
@facundovictor
facundovictor / README.md
Last active July 7, 2016 17:51 — forked from ivanalejandro0/swapon.service
Swap service for CoreOS

swapon.service

A auto swap file configured in a single systemd service.

  1. Copy the service into: /etc/systemd/system/swapon.service
  2. Load the service:systemctl enable /etc/systemd/system/swapon.service
  3. Start the service: systemctl start swapon

Considerations before swapon:

  • The file must be in a partition with enough space
@facundovictor
facundovictor / .gitconfig
Last active August 20, 2021 22:04
My own git shortcuts
[alias]
# Shortcuts
co = checkout
ci = commit
st = status
br = branch
# Get info of a git object
type = cat-file -t
dump = cat-file -p