Skip to content

Instantly share code, notes, and snippets.

View amancevice's full-sized avatar
🐠
oh hello

Alexander Mancevice amancevice

🐠
oh hello
View GitHub Profile
@amancevice
amancevice / template.yml
Last active December 3, 2023 17:13
Serverless Slackbot CloudFormation Template
---
AWSTemplateFormatVersion: "2010-09-09"
Description: Serverless Slackbot
Parameters:
ApiBasePath:
Description: Slack app REST API base path
Type: String
Default: ""
DomainCertificateArn:
@amancevice
amancevice / # terraform - 2023-11-13_09-57-36.txt
Created November 13, 2023 15:14
terraform on macOS 14 - Homebrew build logs
Homebrew build logs for terraform on macOS 14
Build date: 2023-11-13 09:57:36
@amancevice
amancevice / # aws-sam-cli - 2023-10-18_11-31-07.txt
Created October 18, 2023 15:34
aws-sam-cli on macOS 14 - Homebrew build logs
Homebrew build logs for aws-sam-cli on macOS 14
Build date: 2023-10-18 11:31:07
@amancevice
amancevice / ubuntu.html
Created November 16, 2021 16:55
Embed font in AWS Step Functions SVG
<defs>
<style type="text/css">
@import url('https://fonts.googleapis.com/css2?family=Ubuntu');
.label { font-family: "Ubuntu", monospace; font-size: 12px; }
</style>
</defs>
@amancevice
amancevice / http.rb
Last active October 21, 2021 15:44
Send signed HTTP requests to AWS with Ruby
require 'net/http'
require 'aws-sdk-core'
##
# Example usage:
# uri = URI 'https://events.ksr.io/fizz/buzz'
# req = Net::HTTP::Post.new(uri, 'content-type' => 'application/json')
# Aws::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
# http.request(req, { fizz: 'buzz' }.to_json)
@amancevice
amancevice / dynamodb_hash.rb
Created March 30, 2021 13:37
DynamoDB item exploder/contractor
class Hash
def to_dynamodb
self.map { |k,v| [ k.to_s, self.to_dynamodb_item(v) ] }.to_h
end
def from_dynamodb
self.map { |k,v| [ k.to_s, self.from_dynamodb_item(v) ] }.to_h
end
private
@amancevice
amancevice / commit-msg
Last active March 23, 2021 11:12
A git hook for mining Amulets https://text.bargains/amulet/
#!/bin/sh
# .git/hooks/commit-msg
chksum="$( printf "%s" "$(< $1)" | sha256sum )"
amulet="\e[5;1;48mYOU HAVE FOUND %s AMULET\e[0m\n"
if grep 8888888888 > /dev/null <<< $chksum ; then
printf "$amulet" "AN IMPOSSIBLE"
elif grep 888888888 > /dev/null <<< $chksum ; then
printf "$amulet" "A MYTHIC"
elif grep 88888888 > /dev/null <<< $chksum ; then
printf "$amulet" "A LEGENDARY"
@amancevice
amancevice / rainbow
Last active September 16, 2021 16:51
Prints the color codes for 256 colors
#!/bin/bash
rainbow_base_colors() {
for y in {0..1} ; do
for x in {0..7} ; do
c=$(( $x + (8 * $y) ))
tput $t $c
printf " %3s " $c
done
printf '\e[0m\n'
@amancevice
amancevice / index.py
Created January 6, 2021 20:38
Simple and uniform logging in AWS Lambda
import json
import logging
import os
import sys
class SuppressFilter(logging.Filter):
def __init__(self, logger):
self.logger = logger
@amancevice
amancevice / IAMAuth.md
Created September 25, 2020 12:12
Using IAM to authorize requests to AWS

IAM Authorizer

Using IAM to authorize requests to AWS

Construct Authorizer

Construct a custom authorizer class

import boto3