Skip to content

Instantly share code, notes, and snippets.

View made2591's full-sized avatar
🎯
Focusing

Matteo Madeddu made2591

🎯
Focusing
View GitHub Profile
@made2591
made2591 / check_untagged_ec2.py
Created April 29, 2024 07:27
List all ec2 that don't have tags defined
import boto3
import csv
def check_ec2_without_tag(tags_key_to_search, session):
# Initialize the EC2 client using the provided session
ec2_client = session.client('ec2')
# Define a dictionary to store instances without the given tag
instances_without_tag = []
@made2591
made2591 / create_aws_configs.py
Created April 17, 2024 06:26
Create a profile config for each of the accounts inside an org
import boto3
import csv
def list_accounts_in_organization():
# Initialize the Organizations client
org_client = boto3.client('organizations')
accounts = []
# Pagination loop
@made2591
made2591 / check_unencrypted_volumes.py
Created April 17, 2024 06:22
List all unencrypted volumes using all the available profile configured and write them to a CSV file
import boto3
import csv
def list_unencrypted_volumes(session):
# Initialize the EC2 client using the provided session
ec2_client = session.client('ec2')
unencrypted_volumes = []
next_token = None
@made2591
made2591 / mm.go
Created January 14, 2020 22:03
Monad in go
package main
import (
"fmt"
)
func f1(x int) (int, string) {
return x + 1, fmt.Sprintf("%d+1", x)
@made2591
made2591 / fantasanremo.cl
Created February 5, 2023 11:03
This Cingo script helps you find the best Fantasanremo team by looking for artists quotation, and a few bonus malus rules evaluated with my personal estimation. Enjoy the ASP!
#const max_singer = 5.
#const max_baudi = 100.
singer(marco_mengoni,35,1,2,0,1,26).
singer(giorgia,40,0,0,0,2,25).
singer(ultimo,40,2,0,0,0,27).
singer(lazza,110,1,0,0,1,22).
singer(elodie,90,0,0,0,2,24).
singer(madame,110,0,1,0,1,22).
singer(colapesce_dimartino,150,1,0,0,1,20).
@made2591
made2591 / config.h
Created December 14, 2022 15:01 — forked from smlb/config.h
My simple config.h for dwm (you need gap patch)
/* appearance */
static const char font[] = "-*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*";
static const char normbordercolor[] = "#444444";
static const char normbgcolor[] = "#151515";
static const char normfgcolor[] = "#aaaaaa";
static const char selbordercolor[] = "#151515";
static const char selbgcolor[] = "#151515";
static const char selfgcolor[] = "#ff8c00";
static const unsigned int gappx = 2;
static const unsigned int borderpx = 1; /* border pixel of windows */
@made2591
made2591 / index.js
Created March 24, 2018 14:41
AWS Lambda Node.js to get change of status in EC2 instances.
const Slack = require("slack-node");
// Load the AWS SDK for Node.js
const AWS = require("aws-sdk");
// Set the region
AWS.config.update({region: process.env.REGION});
// Create EC2 service object
var ec2 = new AWS.EC2();
function capitalizeFirstLetter(string) {
@made2591
made2591 / handler.py
Created November 29, 2020 16:38
My gist to get my blog read by AWS Polly and my markdown files updated accordingly with new meta
import boto3
import json
import re
import requests
from bs4 import BeautifulSoup
from pathlib import Path
BASE_URL = "YOUR_BASE_URL"
CONTENT_BUCKET = "YOUR_BUCKET_NAME"
@made2591
made2591 / quantum-teleportation.qasm
Created August 13, 2020 13:51
The quantum teleportation for IBM Q
include "qelib1.inc";
// ALICE CODE
// create a 3 qubit register
qreg q[3];
// create a 3 single qubit register
creg c0[1];
creg c1[1];
creg c2[1];
@made2591
made2591 / index.js
Last active June 27, 2020 18:54
AWS Lambda Node.js as slack command handler (with specified grammar)
const AWS = require('aws-sdk');
const Slack = require("slack-node");
AWS.config.region = process.env.REGION;
const lambda = new AWS.Lambda();
// ####################################################
// ################# SECURITY CHECK ###################
// ####################################################
// check if slack token is equal to env var