Skip to content

Instantly share code, notes, and snippets.

View jeremy-donson's full-sized avatar
🎯
Focusing

Jeremy Donson jeremy-donson

🎯
Focusing
  • New York City
View GitHub Profile
@jeremy-donson
jeremy-donson / gather-latest-aws-boot-image-files-[AMI]-per-region.sh
Created December 5, 2017 16:08
BASH SCRIPT: Queries AWS for the *latest* AMI images per global region, writes them to a file, and then reads that file back to us.
#!/bin/bash
# This queries AWS for the *latest* AMI images per global region, writes them to a file, and then reads that file back to us.
for REGION in $(aws ec2 describe-regions --query "Regions[].RegionName" --output json | jq -r '.[]');
do
echo "$region = $(aws ec2 describe-images --owners amazon \
--filters 'Name=name,Values=amzn-ami-hvm-????.??.?.x86_64-gp2'\
--query 'sort_by(Images, &CreationDate) | [-1].ImageId' --region $REGION)";
done > ~/aws-latest-images-per-region.txt
@jeremy-donson
jeremy-donson / validate-yaml-file-with-py3.sh
Last active December 6, 2017 05:50
Trying to use py3 or shyaml to validate a yml file.
# Generate yaml file.
echo -e "# http://yaml.org/spec/\n---\nYAML SPEC RELEASES: DATE\n - Release 1.0: 2004-01-29\n\
- Release 1.1: 2004-12-30 \n - Release 1.2: 2009-09-29\n—--" > yaml-spec-releases-and-dates.yml
cat yaml-spec-releases-and-dates.yml | shyaml -y
cat > known-good-yaml.yml <<EOF
---
invoice: 34843
date : 2001-01-23
import React, { Component } from 'react';
import 'bootstrap/dist/css/bootstrap.css';
import { Collapse, Button, CardBody, Card } from 'reactstrap';
// import './html5-styles.css'
// import logo from './TE-logo.svg'
class Accordion extends Component {
constructor(props) {
super(props);
@jeremy-donson
jeremy-donson / reactstrap-carousel App.js
Created January 9, 2018 12:34
how to apply css to png/jpeg, or would svg be best to support resize?
@jeremy-donson
jeremy-donson / Namer.js
Last active January 12, 2018 14:20
React.js: All desired urls redirect to 404, EXCEPT this pattern. (Blocker 1 of 2)
/*
There is a failed react test which is most pressing:
- /hello/conehead => Responds correctly with "Hello conehead." SUCCESS :)
- ** 404 page rediects work fine as a general rule, but the next item is an exception to that good rule..**
- /hello/cone/head? => Fails as desired, but does NOT get redirected to 404 page. :(
Since I am using react router 4 <Routes>...<Switch>...</Switch> </Routes>,
I believe that I need to extract location params, but that is clearly failing.
@jeremy-donson
jeremy-donson / CountsTests.js
Created January 12, 2018 14:25
React.js counter of /hello/:name kept in state. (Blocker 2 of 2)
/*
See related gist first: Related gist: https://gist.github.com/jeremy-donson/d9eae766cd90591015e1955d1162e30c
There is a counter to track names used ( /name/Bilbo ) while React page state is maintained.
The idea is to go to /counts url and see displayed collected stats on the occurrences of /hello/:name
Sample data structure:
for n in $(pip3 list --outdated --format=freeze | cut -d '=' -f 1)
do
pip3 install $n --upgrade --force
done
# Ideally we would be testing each upgrade before we delete prior versions!!
# for those that fail, rerun with:
sudo -H pip3 install $n --upgrade --force
$ pip3 install pyyaml
$ python3
>>> import yaml
>>> yaml.load("""
... - Hdf
... - Jgd
... - Kjhgd
... """)
['Hdf', 'Jgd', 'Kjhgd']
>>> dat = yaml.load("""
@jeremy-donson
jeremy-donson / jjdonson-2do.txt
Last active September 19, 2019 20:08
Jeremy's Standup To Do List
- [x] Create a gist to track my 2do's.
- [x] List all tasks as GHMD 'to do items'.
- [x] Create repo for working with DonG + team.
- [*] Complete sexual harassment training.
- [*] Review, follow and document ( https://nmfco.sharepoint.com/sites/ips-modernization/Shared%20Documents/Forms/AllItems.aspx?id=%2Fsites%2Fips%2Dmodernization%2FShared%20Documents%2F3%2E%20Program%20Communications%2F5%2E%20Presentations)
=> DevOps KT Session 1 - Key Mgmt.aspx
- [*] Watch intro 2 hour video.
- [*] Await vault access group sync to cloud.
- [*] Complete New Hire Onboarding Process
- [*] Script setup of percona-server 5.7.x docker image on EC2 host.
#!/bin/bash
# install percona-server (8.0.x) on OSX
brew install percona-server
mysql.server start
mysql -uroot -e 'SELECT VERSION()'
mysql.server stop
brew unlink percona-server
mv /usr/local/var/mysql /usr/local/var/mysql8