Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
IP_ADDRESS="$1"
HOSTED_ZONES=$(aws route53 list-hosted-zones)
echo "$HOSTED_ZONES" | jq -r '.HostedZones[].Id' | while read ZONE_ID; do
RECORD_SETS=$(aws route53 list-resource-record-sets --hosted-zone-id "$ZONE_ID" --query "ResourceRecordSets[?ResourceRecords[?Value == '$IP_ADDRESS']].Name")
for RECORD_SET in $RECORD_SETS; do
echo $RECORD_SET
done
done
@hablutzel1
hablutzel1 / AccessingSmartCardThroughPKCS11.java
Created May 2, 2020 21:19
Load java.security.KeyStore with SunPKCS11 provider
import sun.security.pkcs11.SunPKCS11;
import java.security.KeyStore;
import java.security.Security;
import java.security.cert.X509Certificate;
import java.util.Enumeration;
public class AccessingSmartCardThroughPKCS11 implements Test, Test2 {
public static void main(String[] args) throws Exception {
SunPKCS11 sunPKCS11 = new SunPKCS11("pkcs11.cfg");
#!/usr/bin/env bash
# Parameters: <db_host> <db_name> <db_username> <db_password> <pem_cert> <revocation_reason>
#
# TODOS:
#
# - Look for (or develop) something better integrated with EJBCA, e.g. an EJBCA CLI command. Related notes at the top of 'TODOS-EjbcaCt'.
# - If later this script is to be allowed to be executed remotely (not from EJBCA CA as required now), create a dedicated DB user per person with the minimum required DB privileges.
# - Check all commands for their exit status and only continue if the command executed succesfully.
#
@hablutzel1
hablutzel1 / check_roots_inclusion_in_ct_logs.sh
Last active March 18, 2019 17:35
check_roots_inclusion_in_ct_logs
#!/bin/bash
# TODO receive these from the CLI.
declare -a wisroots=("OISTE WISeKey Global Root GA CA" "OISTE WISeKey Global Root GB CA" "OISTE WISeKey Global Root GC CA")
# TODO get the following list from its live location.
declare -a prod_logs=(
"https://ct.googleapis.com/pilot"
"https://ct.googleapis.com/aviator"
"https://ct1.digicert-ct.com/log/"
@hablutzel1
hablutzel1 / JavaVersionComparator.java
Created May 31, 2015 15:39
Basic Comparator to compare/order Java versions, e.g. 1.7.0_79 vs 1.8.0_45
package com.company;
import java.util.Comparator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Very basic comparator
* <p><b>Warning: it could be unstable because there are more possible patterns for Java versions
*/
#!/usr/bin/perl
=head1 DESCRIPTION
printenv — a CGI program that just prints its environment
=cut
print "Content-type: text/plain\r\n\r\n";
for my $var ( sort keys %ENV ) {