Skip to content

Instantly share code, notes, and snippets.

@kylemclaren
kylemclaren / user-data.sh
Created January 21, 2022 09:32 — forked from codeinthehole/user-data.sh
Get the value of an EC2 instance's tag
#!/usr/bin/env bash
#
# Get the value of a tag for a running EC2 instance.
#
# This can be useful within bootstrapping scripts ("user-data").
#
# Note the EC3 instance needs to have an IAM role that lets it read tags. The policy
# JSON for this looks like:
#
# {
@kylemclaren
kylemclaren / har_instructions.md
Created January 19, 2022 16:17 — forked from legrego/har_instructions.md
Kibana HAR Instructions

A HAR archive of the network timings from a compatible browser is extremely useful in pinpointing which issues with Kibana talking to Elasticsearch.

Note on information gathered in a HAR archive

Please note that HAR archives contain sensitive information:

  • content of the pages you downloaded while recording
  • your cookies, which will allow anyone with the HAR file to impersonate your account
  • all the information that you submitted to your browser while recording (i.e., search values, authentication details).
@kylemclaren
kylemclaren / terminate_all_ec2.sh
Created November 19, 2020 22:55 — forked from rjurney/terminate_all_ec2.sh
Bash script to disable termination protection and then terminate all instances in all regions :)
for region in `aws ec2 describe-regions | jq -r .Regions[].RegionName`
do
echo "Terminating region $region..."
aws ec2 describe-instances --region $region | \
jq -r .Reservations[].Instances[].InstanceId | \
xargs -L 1 -I {} aws ec2 modify-instance-attribute \
--region $region \
--no-disable-api-termination \
--instance-id {}
aws ec2 describe-instances --region $region | \
@kylemclaren
kylemclaren / tmux-cheatsheet.markdown
Created April 21, 2016 04:07 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@kylemclaren
kylemclaren / gist:1be98cb24427e16d252b6069d9bfc40f
Created March 31, 2016 22:26 — forked from mtkd/gist:3393155
Pretty print a mongoid document
JSON.pretty_generate(JSON.parse(obj.to_json))
/**
* Typewriter.js 0.0.1
* @author Kyle Foster (@hkfoster)
* @license MIT (http://www.opensource.org/licenses/mit-license.php/)
*/
var typewriter = ( function() {
var headline = document.querySelector( '.typewriter' );
var collectionNames = db.getCollectionNames(), stats = [];
collectionNames.forEach(function (n) { stats.push(db[n].stats()); });
stats = stats.sort(function(a, b) { return b['size'] - a['size']; });
for (var c in stats) { print(stats[c]['ns'] + ": " + stats[c]['size'] + " (" + stats[c]['storageSize'] + ")"); }
// I wanted to know the top five largest collections in my MongoDB database in
// terms of document count. This MongoDB-specific JavaScript gets the job done.
//
// Edit variables in the config section, then execute like so:
//
// mongo --quiet topCollections.js
// config
var dbname = 'FIXME';
environment = process.env.NODE_ENV || "development";
var settings = {
development: {
public: {},
private: {}
},
staging: {
public: {},
private: {}

Meet Meteor

The framework for turning ideas into webapps

A full stack web framework

  • Manages client and server side.
  • Things like Rails manage server side issues.
  • Things like Ember & Angular provide front-end structure.
  • Meteor helps out with both.