Skip to content

Instantly share code, notes, and snippets.

View hltbra's full-sized avatar

Hugo Lopes Tavares hltbra

View GitHub Profile
@ssaunier
ssaunier / importpdb.sublime-snippet
Created July 5, 2018 15:11
Python debugger snippet for Sublime Text
<snippet>
<content><![CDATA[import pdb; pdb.set_trace()]]></content>
<tabTrigger>pdb</tabTrigger>
<scope>source.python</scope>
<description>import pdb</description>
</snippet>
<!-- USAGE -->
<!-- 1. Go to Tools -> New Snippet -->
@hltbra
hltbra / Dockerfile
Created April 2, 2018 18:45
Running a PoC of selenium + chromium + python
FROM python:2.7
RUN apt-get update && \
apt-get install -y --no-install-recommends \
xvfb \
chromium \
chromedriver
RUN pip install selenium
import re
import time
from datetime import datetime, timedelta
import boto3
import json
import hashlib
from botocore.vendored import requests
SUCCESS = "SUCCESS"
FAILED = "FAILED"
@alessandrobologna
alessandrobologna / taskdefinition.py
Last active April 26, 2017 19:48
Custom Task Definition
import json
import boto3
from botocore.vendored import requests
import json
SUCCESS = "SUCCESS"
FAILED = "FAILED"
def lower(s):
return s[:1].lower() + s[1:] if s else s
@jhovell
jhovell / EcsBurstBalance.json
Created February 1, 2017 21:52
ECS BurstBalance monitoring, alerting and healthcheck
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Alerts on ECS burst balance and terminates unhealthy hosts",
"Parameters" : {
"ClusterName": {
"Type": "String",
"Description": "ECS Cluster name"
},
@jmaccabee
jmaccabee / pip_virtualenvs.sh
Last active October 19, 2016 16:41
Script to run Pip across multiple Virtual Environments
#!/bin/bash
######################################################################
# Useful script when you want to run `pip` in virtual environments #
# you have in a common directory with a provided Python package. #
# Note: Requires VirtualWrapper to be managing your environments #
# #
# Usage: #
# ./pip_virtualenvs.sh [-i | -u | -z] pkg_name [-a | -l] [env1 env2] #
# #
# Example: #
@maxvt
maxvt / infra-secret-management-overview.md
Last active February 3, 2025 06:11
Infrastructure Secret Management Software Overview

Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.

This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.

There is a companion feature matrix of various tools. Comments are welcome in the same manner.

SELECT table_name AS "Tables",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB",
round(((data_length + index_length) / 1024 / 1024 / 1024), 2) "Size in GB"
FROM information_schema.TABLES
WHERE table_schema = "PUT_DATABASE_NAME_HERE"
ORDER BY (data_length + index_length) DESC;
@mikelehen
mikelehen / generate-pushid.js
Created February 11, 2015 17:34
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/