Skip to content

Instantly share code, notes, and snippets.

@pjaudiomv
pjaudiomv / update-ssm-tags.sh
Created October 1, 2020 14:11
Tags instances with detected platform and patch group
#!/bin/bash
INSTANCE_IDS=$(aws ssm describe-instance-information --query 'InstanceInformationList[?starts_with(InstanceId, `i-`) == `true` && starts_with(PingStatus, `Online`) == `true`].InstanceId' --output json)
# we don't wan't instances that start with m as they are not taggable, usually workspaces. We also will only tag instances that are online.
export INSTANCE_IDS
echo "Instances that are going to be updated: $INSTANCE_IDS"
echo "$INSTANCE_IDS" | jq -r '.[]' | while read INSTANCE; do
PLATFORM_NAME=$(aws ssm describe-instance-information --instance-information-filter-list key=InstanceIds,valueSet=$INSTANCE --output text --query 'InstanceInformationList[].PlatformName')
PLATFORM_VER=$(aws ssm describe-instance-information --instance-information-filter-list key=InstanceIds,valueSet=$INSTANCE --output text --query 'InstanceInformationList[].PlatformVersion')
@pjaudiomv
pjaudiomv / secgroupdelete_ec2classic.py
Created July 10, 2020 03:12 — forked from arpcefxl/secgroupdelete_ec2classic.py
AWS ec2 security group delete scripts. One script is for ec2-classic, the other is for VPC
#!/usr/bin/env python
# Authored by Chad Smith on 3/10/2015
# please feel free to contact me at [email protected] with comments or questions
# assumes you have already run aws configure or are running in an ec2 role
import boto.ec2, sys
region = sys.argv[1]
secgroup = sys.argv[2]
conn = boto.ec2.connect_to_region(region)
allgroups = conn.get_all_security_groups()
@pjaudiomv
pjaudiomv / jft.php
Last active April 13, 2020 13:55
get jft into array
<?php
$xml = new DOMDocument();
$xml->validateOnParse = true;
$xml->loadHTML(file_get_contents('https://jftna.org/jft/'));
$xpath = new DOMXPath($xml);
$table = $xpath->query("//table")->item(0);
$rows = $table->getElementsByTagName("tr");
$jftKeys = array('date', 'title', 'page', 'quote', 'source', 'content', 'thought', 'copyright');
@pjaudiomv
pjaudiomv / upgrade-bmlt.sh
Last active April 13, 2020 01:59
script for upgrading a BMLT Root Server
#!/bin/sh
# Script for upgrading a BMLT server.
# Basic Usage: < ./bmlt-upgrade.sh > this will download the new release put it in a folder called new_main_server.
# when you have verified everything works you can run < ./bmlt-upgrade.sh complete >
# this will copy main_server to old_main server and new_main_server to main_server
# if url provided we use that, otherwise just get latest release.
if [[ -z "$1" ]];then
RELEASE_URL=$(curl -sL "https://api.github.com/repos/bmlt-enabled/bmlt-root-server/releases/latest" | grep -o '"browser_download_url": *"[^"]*' | grep -o '[^"]*$')
# if jq is available curl -sL "https://api.github.com/repos/bmlt-enabled/bmlt-root-server/releases/latest" | jq -r '.assets[].browser_download_url'
@pjaudiomv
pjaudiomv / repos.html
Created August 3, 2019 17:49
BMLT GitHub Org Repos
<!DOCTYPE html>
<html>
<head>
<title>BMLT GitHub Org Repos</title>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
<style>
table.dataTable tbody, thead {
font: normal normal normal 14px/1.3em "open sans",sans-serif;

Keybase proof

I hereby claim:

  • I am pjaudiomv on github.
  • I am pjaudiomv (https://keybase.io/pjaudiomv) on keybase.
  • I have a public key ASD4fv77svkEtEiJxr9lZGEY_7ABp3lsLNd_vx1j2reF6wo

To claim this, I am signing this object:

<?php
// Get all Counties for the following state, AL, FL, GA, NC, SC
$al_file="http://www2.census.gov/geo/docs/reference/codes/files/st01_al_cou.txt";
$fl_file="https://www2.census.gov/geo/docs/reference/codes/files/st12_fl_cou.txt";
$ga_file="https://www2.census.gov/geo/docs/reference/codes/files/st13_ga_cou.txt";
$nc_file="https://www2.census.gov/geo/docs/reference/codes/files/st37_nc_cou.txt";
$sc_file="https://www2.census.gov/geo/docs/reference/codes/files/st45_sc_cou.txt";
$states = array($al_file, $fl_file, $ga_file, $nc_file, $sc_file);
<?php
// Get all Counties for the following state, AL, FL, GA, NC, SC
$al_file = "http://www2.census.gov/geo/docs/reference/codes/files/st01_al_cou.txt";
$fl_file = "https://www2.census.gov/geo/docs/reference/codes/files/st12_fl_cou.txt";
$ga_file = "https://www2.census.gov/geo/docs/reference/codes/files/st13_ga_cou.txt";
$nc_file = "https://www2.census.gov/geo/docs/reference/codes/files/st37_nc_cou.txt";
$sc_file = "https://www2.census.gov/geo/docs/reference/codes/files/st45_sc_cou.txt";
$states = array($al_file, $fl_file, $ga_file, $nc_file, $sc_file);
@pjaudiomv
pjaudiomv / meetingsByDayLocation.html
Last active January 14, 2019 02:20
meetings By Day By Current Location
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"/></head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://bmlt.sezf.org/main_server/local_server/bmlt.js"></script>
<a id="Day1" href="javascript:selectDay(1)">Sunday</a>
<a id="Day2" href="javascript:selectDay(2)">Monday</a>
<a id="Day3" href="javascript:selectDay(3)">Tuesday</a>
@pjaudiomv
pjaudiomv / MeetingNames.php
Last active January 6, 2019 15:01
Get and count top 20 meeting names in tomato
<?php
$tomatoEndpoint = 'https://tomato.na-bmlt.org/main_server/client_interface/json/?switcher=GetSearchResults&data_field_key=meeting_name';
$meetingNames = json_decode(file_get_contents($tomatoEndpoint), true);
$meetings = array();
foreach ($meetingNames as $key => $value) {
// do a tiny bit of cleanup
$meetings[] = str_replace(' GROUP', '', trim(strtoupper($value['meeting_name'])));