Skip to content

Instantly share code, notes, and snippets.

View paulopatto's full-sized avatar
🎯
Focusing

Paulo Patto paulopatto

🎯
Focusing
View GitHub Profile
@paulopatto
paulopatto / main.tf
Created April 14, 2021 18:09 — forked from danihodovic/main.tf
Terraform - static site using S3, Cloudfront and Route53
variable "aws_region" {
default = "eu-west-1"
}
variable "domain" {
default = "my_domain"
}
provider "aws" {
region = "${var.aws_region}"
@paulopatto
paulopatto / generate-ssh-key.sh
Created April 6, 2020 00:08 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/mozilla_rsa
@paulopatto
paulopatto / proxy.js
Last active November 28, 2023 16:14 — forked from nakedible-p/proxy.js
Script AWS ES proxy
var AWS = require('aws-sdk');
var http = require('http');
var httpProxy = require('http-proxy');
var express = require('express');
var bodyParser = require('body-parser');
var stream = require('stream');
if (process.argv.length != 3) {
console.error('usage: aws-es-proxy <my-cluster-endpoint>');
process.exit(1);
@paulopatto
paulopatto / Setup GCC and CLANG Toolchains.md
Created September 24, 2019 20:19 — forked from bhaskarvk/Setup GCC and CLANG Toolchains.md
Proper GCC (vers. 5/6/7) & LLVM/CLANG (vers. 4/5) Toolchain Setup on Ubuntu/Linux Mint

This approach uses update-alternatives to manage GCC and LLVM/CLANG C/C++ compiler toolchains. Although tested on Linux Mint 18.3, this approach should work on any Debian based distro or for that matter any Linux distro with update-alternatives support, provided the packages are installed correctly.

There are 3 files

  • gcc-alternatives.sh installs GCC versions 5/6/7 and sets up alternatives for gcc/g++/cpp/gfortran.
  • llvm-clang-alternatives.sh installs LLVM and CLANG versions 4/5 and sets up alternatives for various LLVM and CLANG programs including clang and clang++.
  • cc-alternatives.sh sets up alternatives for the cc, cxx, and the ld commands. This script can be used to change systemwide default compiler/linker combination to either GCC or CLANG.

Once these scripts are run you can change the system GCC/CLANG versions by running sudo update-alternatives --config gcc|clang. To change the default compiler/linker combo used by t

@paulopatto
paulopatto / docker-compose.yml
Created June 14, 2018 22:38 — forked from aizatto/docker-compose.yml
docker-compose.yml for MariaDB and Elasticsearch
# https://docs.docker.com/compose/overview/#variables-and-moving-a-composition-between-environments
version: '3'
services:
# https://hub.docker.com/_/mariadb/
database:
image: mariadb:10.3
environment:
- MYSQL_ROOT_PASSWORD=root
volumes:
@paulopatto
paulopatto / Algorithms.md
Last active April 2, 2018 04:31 — forked from entaroadun/gist:1653794
Recommendation and Ratings Public Data Sets For Machine Learning
  • euclidean distance
  • pearson correlation coefficient
  • wighted mean
  • tanimoto coeficient
  • conditional probability
  • gini impurity
  • entropy
  • gaussian function
  • variance
  • dot products
@paulopatto
paulopatto / rubocop_pre_commit_hook
Last active April 19, 2017 07:49 — forked from mpeteuil/rubocop_pre_commit_hook
Ruby style guide git pre-commit hook using Rubocop as the style guide checker. Only runs on staged ruby files that have been added and/or modified.
#!/usr/bin/env ruby
# http://ruby-doc.org/stdlib-2.0.0/libdoc/English/rdoc/English.html
require 'English'
require 'rubocop'
ADDED_OR_MODIFIED = /^\s*(A|AM|M)\s*/
GIT_COMMAND = "git status --porcelain".freeze
modified_files = `#{GIT_COMMAND}`.split(/\n/)
@paulopatto
paulopatto / .tmux.conf.old
Last active August 29, 2015 14:03 — forked from trcarden/gist:3295935
dotfiles
# $Id: screen-keys.conf,v 1.5 2009/10/25 21:58:05 nicm Exp $
#
# By Nicholas Marriott. Public domain.
#
# This configuration file binds many of the common GNU screen key bindings to
# appropriate tmux key bindings. Note that for some key bindings there is no
# tmux analogue and also that this set omits binding some commands available in
# tmux but not in screen.
#
# Note this is only a selection of key bindings and they are in addition to the
#!/usr/bin/env ruby
require 'gosu' # gem install gosu --no-document
include Gosu
$dimension, $splits = 200, 20
$size = $dimension.to_f / $splits.to_f
class Worm
attr_writer :dir
def initialize() reset end
@paulopatto
paulopatto / .pryrc.rb
Last active August 29, 2015 13:57 — forked from dlisboa/gist:9416144
Pryrc para usar o vim
require 'irb/completion'
def vi
require 'tempfile' unless defined? Tempfile
@f ||= Tempfile.new('irb-interactive')
system('vim', @f.path)
Object.class_eval File.read(@f.path) if $?.success?
end
at_exit do
puts @f.path