Skip to content

Instantly share code, notes, and snippets.

@Carlovo
Carlovo / one_click_aws_wafv2_web_acl.tf
Created August 22, 2024 18:37
Consice Terraform way of writing the WAF v2 web ACL CloudFront one-click produces
# Provider needs to be us-east-1
resource "aws_wafv2_web_acl" "cdn_acl" {
name = "some-friendly-id"
scope = "CLOUDFRONT"
default_action {
allow {}
}
dynamic "rule" {
@Carlovo
Carlovo / more_informational_prompt.sh
Last active June 14, 2024 08:42
Show pwd and git branch, and hide default user/host for conciseness
# Your .bashrc probably contains something like this:
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
# Replace it with this to show your git branch and condense the default user/host name to a single character
# (Replace with your default user/host name of course):
condense_default_user_host() {
@Carlovo
Carlovo / python_utensils.sh
Last active June 14, 2024 08:43
Python command line utensils
python -m http.server
python -m calendar 2000
python -c 'import datetime as dt; print(dt.datetime.utcnow());'
python -c 'import random; import string; print(random.choice(string.ascii_uppercase));'
python -c 'import uuid; print(uuid.uuid4());'
@Carlovo
Carlovo / bubble_wrap_python-README.md
Last active November 27, 2024 20:33
[DEPRECATED] Python development bubble wrap bash

While all of this is still true; it is outclassed by https://github.com/Carlovo/straight_to_the_money or any other more modern Python dev flow.

This is a very basic bubble wrap you can fold yourself in while developing python. If you want more, refer to the docs of the tools installed. Or, if you want alternatives, scour your favorite tech blog post website.

Mind the fact that you are setting some evanescent and dynamic env vars and stuff per folder along the way. Make a nifty script or alias or something for yourself, so you don't have to copy-paste this stuff all the time.

Correct order:

@Carlovo
Carlovo / just_sort.py
Created May 28, 2024 09:05
Just sort it, damnit!
mixed_list = [5, 'ggg', 4, b'mmm', b'ddd']
sorted_mixed_list = sorted(mixed_list, key=str)
@Carlovo
Carlovo / tfvars_demo.auto.tfvars
Created May 2, 2022 17:51
Input Variables per Local Terraform Workspace
workspace_variables = {
dev = {
instance_count = 2
ami_id = "ami-abc123"
instance_type = "t2.micro"
}
test = {
instance_count = 3
ami_id = "ami-a1b2c3"
instance_type = "t2.medium"