Skip to content

Instantly share code, notes, and snippets.

View carlopires's full-sized avatar

Carlo Pires carlopires

  • Aldeia Global
  • Goiânia/Brazil
View GitHub Profile
@carlopires
carlopires / ISO639_2.py
Created October 4, 2011 16:06 — forked from austing/gist:779243
Python dict with ISO-639-2 language codes
# -o- coding: utf-8 -o-
# ISO639 python dict
# oficial list in http://www.loc.gov/standards/iso639-2/php/code_list.php
ISO639_2 = {
'ab': 'Abkhaz',
'aa': 'Afar',
'af': 'Afrikaans',
'ak': 'Akan',
'sq': 'Albanian',
@carlopires
carlopires / bootstrap-plugins.txt
Created January 18, 2012 12:30 — forked from mklabs/bootstrap-plugins.txt
h5bp + twitter bootstrap integration
bootstrap-tooltip.js
bootstrap-popover.js
bootstrap-alert.js
bootstrap-button.js
bootstrap-carousel.js
bootstrap-collapse.js
bootstrap-dropdown.js
bootstrap-modal.js
bootstrap-scrollspy.js
bootstrap-tab.js
@carlopires
carlopires / service-checklist.md
Created February 16, 2017 00:17 — forked from acolyer/service-checklist.md
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@carlopires
carlopires / curio_tls.py
Created June 5, 2017 19:19 — forked from vsajip/curio_tls.py
Demonstrates wrapping of sockets for TLS using contexts which are not Curio's own.
from wsgiref.handlers import format_date_time
import curio
from curio import network
from curio import socket
from curio.io import Socket
import h11
import tls
@carlopires
carlopires / extensions.lua
Created January 17, 2019 20:14 — forked from igmar/extensions.lua
Asterisk LUA dialplan
require("lsqlite3")
-- Igmar: Wanneer closen we dat DB object eigenlijk ?
db = sqlite3.open('/etc/asterisk/users.sqlite')
--CONSOLE = "Console/dsp" -- Console interface for demo
--CONSOLE = "DAHDI/1"
--CONSOLE = "Phone/phone0"
TRUNK = "DAHDI/G1"
@carlopires
carlopires / gist:86cf32ab5a252dbbf4edbd82b9380f3b
Created January 28, 2019 13:46 — forked from econchick/gist:4666413
Python implementation of Dijkstra's Algorithm
class Graph:
def __init__(self):
self.nodes = set()
self.edges = defaultdict(list)
self.distances = {}
def add_node(self, value):
self.nodes.add(value)
def add_edge(self, from_node, to_node, distance):
@carlopires
carlopires / dijkstra.py
Created January 28, 2019 13:50 — forked from mdsrosa/dijkstra.py
Modified Python implementation of Dijkstra's Algorithm (https://gist.github.com/econchick/4666413)
from collections import defaultdict, deque
class Graph(object):
def __init__(self):
self.nodes = set()
self.edges = defaultdict(list)
self.distances = {}
def add_node(self, value):
@carlopires
carlopires / Testing_local_HTTPS_project.md
Created February 1, 2019 14:42 — forked from powerman/Testing_local_HTTPS_project.md
Cheat sheet: How to securely test local/staging HTTPS project

How to securely test local/staging HTTPS project

Modern projects often support HTTPS and HTTP/2, moreover they can use Strict-Transport-Security: and Content-Security-Policy: headers which result in different behaviour for HTTP and HTTPS versions, or even completely forbid HTTP version. To develop and test such project locally, on CI, and at staging server we either have to provide a way to access it using HTTP in non-production environments (bad idea) or somehow make it work with HTTPS everywhere.

HTTP in non-production environments is a bad idea because we'll test not the same thing which will runs on production, and because there is a chance to occasionally keep HTTP enabled on production too.

@carlopires
carlopires / rate_limit2.py
Created September 26, 2019 18:04 — forked from josiahcarlson/rate_limit2.py
Regular and sliding window rate limiting to accompany two blog posts.
'''
rate_limit2.py
Copyright 2014, Josiah Carlson - [email protected]
Released under the MIT license
This module intends to show how to perform standard and sliding-window rate
limits as a companion to the two articles posted on Binpress entitled
"Introduction to rate limiting with Redis", parts 1 and 2:
@carlopires
carlopires / openssl.MD
Created October 14, 2019 16:30 — forked from jchandra74/openssl.MD
HOWTO: Create Your Own Self-Signed Certificate with Subject Alternative Names Using OpenSSL in Ubuntu Bash for Window

HOWTO: Create Your Own Self-Signed Certificate with Subject Alternative Names Using OpenSSL in Ubuntu Bash for Window

Overview

My main development workstation is a Windows 10 machine, so we'll approach this from that viewpoint.

Recently, Google Chrome started giving me a warning when I open a site that uses https and self-signed certificate on my local development machine due to some SSL certificate issues like the one below:

Self-Signed SSL Issue in Chrome