Skip to content

Instantly share code, notes, and snippets.

View sylwit's full-sized avatar

Sylvain Witmeyer sylwit

View GitHub Profile
@sylwit
sylwit / delete-workflow-runs.sh
Last active April 21, 2023 21:06
This bash script deletes all the runs from a Github Actions workflow, since you can't delete a workflow from the UI
#!/bin/bash
# Set the repository owner and name
owner="<owner>"
repo="<repo>"
# Replace <YOUR-PAT> with your actual Personal Access Token PAT
PAT="<YOUR-PAT>"
@sylwit
sylwit / deploy.yaml
Created December 8, 2021 03:48
Github workflow to deploy a static app on Backblaze
name: Build and deploy react app to Backblaze
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
@sylwit
sylwit / stateful.py
Created October 9, 2021 04:19
Stateful lambda
counter = 0
def lambda_handler(event, context):
global counter
if counter >= 5:
counter = 0
counter = counter + 1
print(counter)
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive;
echo "[*] Starting Install... [*]"
echo "[*] Upgrade installed packages to latest [*]"
echo -e "\nRunning a package upgrade...\n"
apt-get -qq update && apt-get -qq dist-upgrade -y
apt full-upgrade -y
apt-get autoclean
echo "[*] Install stuff I use all the time [*]"
@sylwit
sylwit / cloud_metadata.txt
Created May 24, 2021 13:08 — forked from BuffaloWill/cloud_metadata.txt
Cloud Metadata Dictionary useful for SSRF Testing
## IPv6 Tests
http://[::ffff:169.254.169.254]
http://[0:0:0:0:0:ffff:169.254.169.254]
## AWS
# Amazon Web Services (No Header Required)
# from http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html#instancedata-data-categories
http://169.254.169.254/latest/meta-data/iam/security-credentials/dummy
http://169.254.169.254/latest/user-data
http://169.254.169.254/latest/user-data/iam/security-credentials/[ROLE NAME]
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKw9bHhJR+ZqItrsBZUWaQmEwvU4qd3L6VsZ9ShSx/sC sylvain.witmeyer@gmail.com
@sylwit
sylwit / gist:9dd0a8e5ff419d38d3ade321e454a7a1
Created December 1, 2020 16:23
UserScript - AWS signin SAML - Name AWS account id
// ==UserScript==
// @name AWS signin SAML
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Name AWS account id
// @author sylwit <sylvain.witmeyer@gmail.com>
// @match https://signin.aws.amazon.com/saml
// @grant none
// ==/UserScript==
@sylwit
sylwit / asciinema_rewrite.sh
Last active November 20, 2020 03:00
asciinema rewrite
#!/bin/bash
# This script rewrites history of an asciinema cast from a starting point in time
# ex: ./asciinema_rewrite.sh in.cast 17.452 3 > out.cast, will remove 3 seconds of each record after 17.452sec
if [[ $# -ne 3 ]]; then
echo "Invalid number of arguments"
echo "Usage: $0 filename starting_time remove_time > out.cast"
exit 2
fi
@sylwit
sylwit / Makefile
Created July 18, 2020 15:31
Terraform with aw-vault template
account := acc
VARS_ENV="variables/$(TF_WORKSPACE).tfvars"
VARS_SECRETS="variables/$(TF_WORKSPACE)-secrets.tfvars"
fmt:
terraform fmt
workspace:
aws-vault exec $(account) -- terraform workspace list