Skip to content

Instantly share code, notes, and snippets.

View b-b3rn4rd's full-sized avatar

Bernard Baltrusaitis b-b3rn4rd

  • Bendigo Bank
  • Melbourne
View GitHub Profile
@jonathan-kosgei
jonathan-kosgei / schedule_function.sh
Created April 19, 2017 03:52
AWS Lambda backup EBS volumes with BOTO3
# Scheduling the above script hourly. Ensure you're properly authenticated via aws configure.
#!/bin/bash
zip ebs-backup-worker.zip .schedule-ebs-snapshot-backups.py
aws lambda create-function --function-name ebs-backup-worker \
--runtime python2.7 \
--role "arn for your lambda user's role" \
--handler lambda_handler \
--zip-file fileb:///ebs-backup-worker.zip
@toff63
toff63 / terraform_retrieve_secret_aws.tf
Created December 10, 2018 17:21
How to retrieve a secret stored in AWS Secret Manager in terraform.
variable "region" {}
variable "access_key" {}
variable "secret_key" {}
provider "aws" {
version = "~> 1.25"
region = "${var.region}"
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"}
@galiana
galiana / [email protected]
Created January 16, 2020 09:01
Transforming MongoDB WebHooks notifications payload into Microsoft teams message cards
#r "Newtonsoft.Json"
using System.Net;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
using System.Net.Http.Headers;
public static async Task<IActionResult> Run(HttpRequest req, ILogger log)
{
@gwalkey
gwalkey / gist:b168d532b472333e96663cf607bf84eb
Last active October 13, 2025 15:16
Create a NuGet Package to Install a Powershell Module
Download the CLI Version of NuGet
https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
--Create Work Paths
md c:\nuget
md c:\nuget\source
md c:\nuget\publish
-- One-Time - Create local NuGet Repo/feed using a local drive path
cd c:\nuget
@GrigorievNick
GrigorievNick / GracefulStopOnShutdownListener.scala
Last active January 23, 2025 11:57
Spark Structure Streaming GraceFullShutdown on Sigterm. Sigterm will not interrupt currently running batch, but due to asynс nature of SparkQueryListner.onProgres method, can interrupt next batch during first few moments.
import org.apache.hadoop.util.ShutdownHookManager
import org.apache.spark.sql.streaming.StreamingQueryListener
import org.apache.spark.sql.streaming.StreamingQueryManager
import org.slf4j.LoggerFactory
import java.util.UUID
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.SynchronousQueue
import java.util.concurrent.TimeUnit
@tuansoibk
tuansoibk / cryptography-file-formats.md
Last active October 21, 2025 14:06
Cryptography material conversion and verification commands
  1. Introduction
  2. Standards
  3. Common combinations
  4. Conversion
  5. Verification/Inspection
  6. Tips for recognising

Introduction

It happens that there are many standards for storing cryptography materials (key, certificate, ...) and it isn't always obvious to know which standard is used by just looking at file name extension or file content. There are bunch of questions on stackoverflow asking about how to convert from PEM to PKCS#8 or PKCS#12, while many tried to answer the questions, those answers may not help because the correct answer depends on the content inside the PEM file. That is, a PEM file can contain many different things, such as an X509 certificate, a PKCS#1 or PKCS#8 private key. The worst-case scenario is that someone just store a non-PEM content in "something.pem" file.