Skip to content

Instantly share code, notes, and snippets.

View JavierBmrg's full-sized avatar

Edward Fernández JavierBmrg

View GitHub Profile
@JavierBmrg
JavierBmrg / main.tf
Created July 14, 2019 05:32
Example of terraform with chef provisioner
provider "aws" {
region = "${var.region}"
profile = "${var.profile}"
allowed_account_ids = ["${var.aws_account_id}"]
}
data "aws_availability_zones" "available" {}
data "aws_ami" "amazon_linux" {
most_recent = true
@JavierBmrg
JavierBmrg / PYTHON_DEFAULT.md
Created April 3, 2019 14:43 — forked from patrickmmartin/PYTHON_DEFAULT.md
update-alternatives for python3 on Ubuntu

Ubuntu 16 default python is almost python 3

Loads of solutions exist, but for changing the system default, alias is not the way to go.

$ update-alternatives --list python update-alternatives: error: no alternatives for python

@JavierBmrg
JavierBmrg / change_default_gh_branch.py
Created March 15, 2019 20:02 — forked from wehappyfew/change_default_gh_branch.py
Change the default branch of a GH repo. I use it with CodeDeploy in order to deploy different branch each time. Enjoy.
import json,requests,pprint
gh_url = "https://api.github.com"
username = 'wehappyfew'
# a token is needed for 2 Factor Auth, otherwise only Name/Pass
custom_token = 'blablablablablablabla' # a custom personal token from GitHub
repo_name = 'your_repo_name'
new_default_branch = 'something' # this is going to change every time
#encode to JSON
@JavierBmrg
JavierBmrg / nginx.conf
Created January 26, 2019 00:08 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048

React lifecycle cheatsheet

Method Side effects1 State updates2 Example uses
Mounting
componentWillMount Constructor equivalent for createClass
render Create and return element(s)
componentDidMount DOM manipulations, network requests, etc.
Updating
componentWillReceiveProps Update state based on changed props
<html>
<script src="https://code.highcharts.com/maps/highmaps.js"></script>
<script src="https://code.highcharts.com/mapdata/custom/europe.js"></script>
<script src="https://code.highcharts.com/mapdata/custom/south-america.js"></script>
<body>
<div id="container" style="height: 500px; min-width: 310px; max-width: 600px; margin: 0 auto"></div>
<script>
@JavierBmrg
JavierBmrg / genSvgMap.html
Last active March 22, 2018 04:46
Generate highlight area inside regional map with jqvmap
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>JQVMap - Europe Map</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqvmap/1.5.1/jqvmap.min.css" media="screen" rel="stylesheet" type="text/css"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0/js/bootstrap.min.js" media="screen" rel="stylesheet" type="text/css"/>
@JavierBmrg
JavierBmrg / Countries-ISO3166-2
Created March 20, 2018 19:56
List of all world countries ISO3166 based
[{
"Code": "AF",
"Name": "Afghanistan"
}, {
"Code": "AX",
"Name": "\u00c5land Islands"
}, {
"Code": "AL",
"Name": "Albania"
}, {
@JavierBmrg
JavierBmrg / iptables_rules.sh
Created December 4, 2016 15:16 — forked from virtualstaticvoid/iptables_rules.sh
25 Most Frequently Used Linux IPTables Rules Examples
# Modify this file accordingly for your specific requirement.
# http://www.thegeekstuff.com
# 1. Delete all existing rules
iptables -F
# 2. Set default chain policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP