Skip to content

Instantly share code, notes, and snippets.

View lmammino's full-sized avatar
🦁
Roar!

Luciano Mammino lmammino

🦁
Roar!
View GitHub Profile
@lmammino
lmammino / Cargo.toml
Created May 1, 2024 17:51
Poor man async rust HTTP load testing tool
[package]
name = "send-requests"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
chrono = "0.4.38"
clap = { version = "4.5.4", features = ["derive"] }
@lmammino
lmammino / README.md
Last active March 19, 2024 18:37
Setup SSM to connect your VSCode to a remote Cloud9 Instance (awsbites.com)

Initial steps

  1. Launch Cloud9 IDE with SSM option
  2. When it launchers, open the Cloud9 IDE in the AWS Console

With SSM

Install:

  • AWS CLI
@lmammino
lmammino / README.md
Created March 18, 2024 14:18
Rust Lambda Workshop Requirements
@lmammino
lmammino / gen_dkim.py
Created March 3, 2018 17:52
Generate dkim keys and a TXT record file for AWS Route 53
#!/usr/bin/env python
# Usage
# ./gen_dkim.py mail.yourdomain.tld
import sys
from subprocess import call
from os import devnull
if len(sys.argv) < 2:
@lmammino
lmammino / curlStreamedDownload.php
Created December 21, 2012 15:15
Download a large file (streaming) with php and curl extension
<?php
$url = 'http://www.example.com/a-large-file.zip';
$path = '/path/to/a-large-file.zip';
$fp = fopen($path, 'w');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FILE, $fp);
$data = curl_exec($ch);
{
"Version": "2012-10-17",
"Statement": {
"Effect": "Deny",
"Action": "*",
"Resource": "*",
"Condition": {
"DateLessThan": {"aws:TokenIssueTime": "2014-05-07T23:47:00Z"}
}
}
@lmammino
lmammino / README.md
Created March 17, 2019 10:57
Pass arrays to shared libraries from python using C types

Pass arrays to shared libraries from python using C types

This example implements a simple shared library in C.

This library called libfifthy exposes a function called add_fifthy which takes an array of integers and modify it in place by adding 50 to all elements.

Then there's some code in python which builds an array and invokes the add_fifthy from the shared library and reads the altered array values.

Usage

@lmammino
lmammino / example.json
Created November 6, 2017 16:00
A sample message coming from SQS with a payload coming from SNS
{
"Messages": [
{
"Body": "{\n \"Type\" : \"Notification\",\n \"MessageId\" : \"abcdef01-2345-6789-0abc-defg123456783\",\n \"TopicArn\" : \"arn:aws:sns:eu-west-1:123456789012:ticketless-ticketPurchased\",\n \"Message\" : \"{\\\"ticket\\\":{\\\"id\\\":\\\"abcdef01-2345-6789-0abc-defg123456784\\\",\\\"createdAt\\\":1509980177897,\\\"name\\\":\\\"Alex Smith\\\",\\\"email\\\":\\\"email@example.com\\\",\\\"gig\\\":\\\"nirvana-cork-1991\\\"},\\\"gig\\\":{\\\"capacity\\\":2300,\\\"collectionPoint\\\":\\\"29 South Main Street, Centre, Cork City, Co. Cork, Ireland\\\",\\\"collectionTime\\\":\\\"13:00\\\",\\\"slug\\\":\\\"nirvana-cork-1991\\\",\\\"originalDate\\\":\\\"1991-08-20\\\",\\\"venue\\\":\\\"Cavern Club\\\",\\\"bandName\\\":\\\"Nirvana\\\",\\\"city\\\":\\\"Cork\\\",\\\"date\\\":\\\"2019-06-21\\\",\\\"image\\\":\\\"nirvana.jpg\\\",\\\"year\\\":\\\"1991\\\",\\\"collectionPointMap\\\":\\\"map-nirvana-cork-1991.png\\\",\\\"description\\\":\\\"Lorem Ipsum\\\",\\\"price\\\":\\\"1666.60\\\"}}\",\n \"
@lmammino
lmammino / promise-with-resolvers-polyfill.js
Created July 18, 2023 17:57
Promise.withResolvers() polyfill
if (typeof Promise.withResolvers === 'undefined') {
Promise.withResolvers = function () {
let resolve, reject
const promise = new Promise((res, rej) => {
resolve = res
reject = rej
})
return { promise, resolve, reject }
}
}
@lmammino
lmammino / LICENSE
Last active June 19, 2023 14:37
Decode Body of JWT tokens with bash
The `decode` function has been re-adapted from code provided by Moodstocks SAS and
therefore the following license applies to it:
Copyright (C) 2014 by Moodstocks SAS
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is