Skip to content

Instantly share code, notes, and snippets.

@addiedx44
addiedx44 / cryptography-file-formats.md
Created October 23, 2023 15:09 — forked from tuansoibk/cryptography-file-formats.md
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.

@addiedx44
addiedx44 / terraform-providers-lock.sh
Created December 1, 2022 16:57
Generate Terraform lock for all platforms
terraform providers lock \
-platform=windows_amd64 \
-platform=darwin_amd64 \
-platform=linux_amd64 \
-platform=darwin_arm64 \
-platform=linux_arm64
@addiedx44
addiedx44 / aws_assume_role
Created May 17, 2022 16:40 — forked from gene1wood/aws_assume_role
Workaround AWS CLI lack of support for IAM assume-role
#!/bin/bash
usage () {
cat <<DOCUMENTATIONXX
Usage : . $0 ROLE_ARN [PARENT_PROFILE_NAME]
^--- Note that this script must be sourced not executed
This tool will generate temporary credentials for an assumed role, save
those ephemeral credentials in the awscli config and set the alias of
"aaws" to use this new ephemeral awscli profile
wget https://yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpg --quiet --with-fingerprint /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
echo <<EOF >/etc/yum.repos.d/ol7-temp.repo
[ol7_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL7/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
@addiedx44
addiedx44 / gravatar.sh
Created June 20, 2016 19:35 — forked from kristopherjohnson/gravatar.sh
Download Gravatar image for an email address
curl "http://gravatar.com/avatar/$(md5 -q -s myemail@example.com)" > avatar.png
@addiedx44
addiedx44 / setup-dnsmasq-macosx.sh-session
Created June 1, 2016 18:03
Set up Dnsmasq on Mac OS X
$ # Install dnsmasq
$ brew update && brew install dnsmasq
$ # Edit dnsmasq config, paste contents
$ mkdir -p /usr/local/etc && vim /usr/local/etc/dnsmasq.conf
$ # Start dnsmasq (it will restart at startup)
$ sudo brew services start dnsmasq
==> Successfully started `dnsmasq` (label: homebrew.mxcl.dnsmasq)
@addiedx44
addiedx44 / active_support_test_unit_pass_count.rb
Last active June 2, 2016 14:46 — forked from pmatsinopoulos/active_support_test_unit_pass_count.rb
ActiveSupport::Testing to count the Passed Tests when using Test::Unit
require 'active_support/concern'
require 'active_support/callbacks'
module ActiveSupport
module Testing
module SetupAndTeardown
module ForClassicTestUnit
# This redefinition is unfortunate but test/unit shows us no alternative.
# Doubly unfortunate: hax to support Mocha's hax.
def run(result)
@addiedx44
addiedx44 / git-ls-files.sh
Created May 26, 2016 15:50
Check if $thing is tracked by git
git ls-files path/to/something --error-unmatch
#!/usr/bin/env ruby
##
# Solution for http://www.ancientcityruby.com/snake_case/
#
# How many different paths could I take from the northwest corner to the
# southeast corner of a rectangular grid, only ever moving south or east?
#
# Usage: ./snake_case.rb <size
# ./snake_case.rb <length> <width>
Verifying that +adamdunson is my blockchain ID. https://onename.com/adamdunson