Skip to content

Instantly share code, notes, and snippets.

View CarlosDomingues's full-sized avatar

Carlos Domingues CarlosDomingues

View GitHub Profile
aparrish / understanding-word-vectors.ipynb
Last active June 16, 2024 02:26
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0, other text released under CC BY 4.0
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
bsara /
Last active June 12, 2024 21:09
Setup SSH Authentication for Git Bash on Windows

Setup SSH Authentication for Git Bash on Windows


  1. Create a folder at the root of your user home folder (Example: C:/Users/uname/) called .ssh.
  2. Create the following files if they do not already exist (paths begin from the root of your user home folder):
  • .ssh/config
gene1wood /
Last active June 11, 2024 21:15
Python relative imports in AWS Lambda fail with `attempted relative import with no known parent package`

Python relative imports in AWS Lambda fail with attempted relative import with no known parent package

The Problem

In AWS Lambda if I attempt an explicit relative import like this

CarlosDomingues /
Last active May 19, 2024 05:20
Python Poetry Cheatsheet

Create a new project

poetry new <project-name>

Add a new lib

poetry add <library>

Remove a lib

# -*- coding: utf-8 -*-
# Print iterations progress
def print_progress(iteration, total, prefix='', suffix='', decimals=1, bar_length=100):
Call in a loop to create terminal progress bar
iteration - Required : current iteration (Int)
total - Required : total iterations (Int)
prefix - Optional : prefix string (Str)
cube-drone /
Last active March 26, 2024 20:24
Automation For The People

Automation for the People

Long ago, the first time I read "The Pragmatic Programmer", I read some advice that really stuck with me.

"Don't Use Manual Procedures".

This in the chapter on Ubiquitous Automation. To summarize, they want you to automate all the things.

The trouble was that I hadn't much of an idea how to actually go

isaqueprofeta /
Last active March 12, 2024 12:56
Passos para instalação de certificados do SERPRO no Ubuntu
# Entrar na pasta de certificados do sistema:
# Ubuntu anterior ao 18:
sudo mkdir /usr/share/ca-certificates/serpro/
sudo cd /usr/share/ca-certificates/serpro/
# Ubuntu 18:
sudo mkdir /usr/local/share/ca-certificates/serpro/
cd /usr/local/share/ca-certificates/serpro/
# Baixar os certificados do repositorio:
wget -r --no-check-certificate
bortzmeyer / gist:1284249
Created October 13, 2011 13:42
The only simple way to do SSH in Python today is to use subprocess + OpenSSH...
# All SSH libraries for Python are junk (2011-10-13).
# Too low-level (libssh2), too buggy (paramiko), too complicated
# (both), too poor in features (no use of the agent, for instance)
# Here is the right solution today:
import subprocess
import sys
sgtoj /
Last active February 13, 2024 18:58
AWS SSO Credentials File Updater for AWS SDKs
#!/usr/bin/env python3
import json
import os
import sys
from configparser import ConfigParser
from datetime import datetime
from pathlib import Path
import boto3
config vpn ipsec phase1-interface
edit <<ID>>-0
set interface "wan1"
set dpd on-idle
set local-gw
set dhgrp 2
set proposal aes128-sha1
set keylife 28800
set remote-gw <<Remote-Global-IP-0>>
set psksecret <<Secret-Key-0>>