Skip to content

Instantly share code, notes, and snippets.

View CarlosDomingues's full-sized avatar

Carlos Domingues CarlosDomingues

View GitHub Profile
@CarlosDomingues
CarlosDomingues / kodolow.md
Last active April 29, 2022 19:39
Kubernetes on Docker on Linux on Windows

Kubernetes on Docker on Linux on Windows

This guide shows how to run Kubernetes in a Windows Host, using kind to run the control plane in Docker and WSL 2 to run Docker itself.

The whole point of doing that is to run Kubernetes:

  1. In a Windows Host
  2. Without managing virtual machines (Docker Desktop + WSL 2 will do that for us)
  3. Without using Docker Desktop's native Kubernetes feature (as it has a tendency to break workflows that do not relly on K8s).

Sync a fork with upstream

Run the following (note: use main/master as needed):

git fetch upstream
git checkout master
git merge upstream/master
git push origin master
@CarlosDomingues
CarlosDomingues / systemd-timers-example.md
Created March 21, 2022 13:43
systemd timers example

A simple example of systemd timers. Inspired by this blog post.

1 - Go to /etc/systemd/system

2 - Create a FreeMemoryStatistics.service unit file like so:

[Unit]
Description=Logs free memory statistics to the systemd journal
Wants=FreeMemoryStatistics.timer
@CarlosDomingues
CarlosDomingues / Cleaning all Docker stuff.md
Created January 25, 2022 21:53
How to clean everything related to Docker
docker system prune --all --force --volumes
@CarlosDomingues
CarlosDomingues / Python 3.10 on Ubuntu 20 on Windows 11.md
Last active January 13, 2022 18:50
Python 3.10 on Ubuntu 20 on Windows 11

A guide on how to install Python 10 on WSL2 under Windows 10 / 11.

Install pyenv

pyenv is a tool that allows switching the global Python version, or choosing a specific version per project.

sudo apt update --yes
sudo apt install --yes build-essential curl git libbz2-dev liblzma-dev libffi-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libsqlite3-dev llvm make python3-openssl tk-dev wget xz-utils zlib1g-dev
curl https://pyenv.run | bash

Keybase proof

I hereby claim:

  • I am CarlosDomingues on github.
  • I am cfelipe (https://keybase.io/cfelipe) on keybase.
  • I have a public key whose fingerprint is 0196 AC06 4E01 CC93 C0C3 CBEA BFEE EE81 7E26 3C9A

To claim this, I am signing this object:

@CarlosDomingues
CarlosDomingues / local_bundler.py
Last active February 13, 2024 22:22
Implementing aws_cdk.core.ILocalBundling in Python (avoids using Docker for bundling)
from aws_cdk.core import (
BundlingDockerImage,
BundlingOptions,
ILocalBundling
)
from aws_cdk.aws_lambda import Code
from jsii import implements, member
@implements(ILocalBundling)
class MyLocalBundler:
Error:
No valid credentials found for Spotinst Provider.
Please see https://www.terraform.io/docs/providers/spotinst/index.html
for more information on providing credentials for Spotinst Provider.
on <empty> line 0:
(source code not available)
@CarlosDomingues
CarlosDomingues / python-poetry-cheatsheet.md
Last active April 27, 2024 14:24
Python Poetry Cheatsheet

Create a new project

poetry new <project-name>

Add a new lib

poetry add <library>

Remove a lib

@CarlosDomingues
CarlosDomingues / gist:b002d9af55ff86345fdabe201362fe33
Created June 8, 2018 16:27
Running SetUp a single time on Python unittests
import unittest
from my_program import MyClass
class MyClassTest(unittest.TestCase):
# First define a class variable that determines
# if setUp was ever run
ClassIsSetup = False
def setUp(self):
# If it was not setup yet, do it