Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan D ryan0x44

View GitHub Profile
@ryan0x44
ryan0x44 / node-via-docker-run.md
Created Jul 9, 2018
Node/NPM/Yarn via Docker Run
View node-via-docker-run.md

To start a bash prompt with only Docker installed on your host OS, run the following command:

docker run --rm -v $PWD:/src -w /src -u node -it node /bin/bash

Here's what each parameter does:

  • --rm removes the container once you exit
  • -v $PWD:/src will mount your current host working directory into /src inside the container
View get-docker-image-cmd.sh
#!/bin/bash -e
# Using the "hello-world" image as an example
# https://github.com/docker-library/hello-world/blob/c83a065a24e94e635ddd518c2a3cffc91accf30d/amd64/hello-world/Dockerfile#L3
# `CMD ["/hello"]`
docker pull hello-world
docker inspect -f "{{.Config.Cmd}}" hello-world | cut -f2 -d "[" | cut -f1 -d "]"
# produces: `/hello`
@ryan0x44
ryan0x44 / markdown-chrome-preview.sh
Created Feb 27, 2018
Preview Markdown in Chrome
View markdown-chrome-preview.sh
MD_FILE="README.md"
TMP_FILE=$(mktemp); pandoc $MD_FILE > $TMP_FILE; open -a "Google Chrome" $TMP_FILE && rm $TMP_FILE
@ryan0x44
ryan0x44 / pwnedpasswordcount.sh
Created Feb 24, 2018
Find out how many times your password has been pwned
View pwnedpasswordcount.sh
#!/bin/bash
# set pw to the password you want to lookup (of course, be careful with writing this to your shell history or unencrypted disk!)
pw="insecure"
# this will output the number of times it has been pwned
s=$(echo -n $pw | openssl sha1 | tr '[a-z]' '[A-Z]'); curl -s "https://api.pwnedpasswords.com/range/${s:0:5}" | grep "${s:5}" | cut -d ":" -f 2
@ryan0x44
ryan0x44 / sentry_event.sh
Created Nov 28, 2017
Send events to Sentry from bash
View sentry_event.sh
#!/bin/bash -e
# sentry_event params: [event_id] [culprit] [message] [optional:extra]
sentry_event() {
# Get current unix timestamp
TIMESTAMP=`date +%s`
# Parse DSN
TEMP=`echo $SENTRY_DSN | cut -d '/' -f3`
@ryan0x44
ryan0x44 / Example1.java
Last active Feb 12, 2020
Java Checkstyle Cyclomatic Complexity Example
View Example1.java
public class Example1 {
public static void main(String[] args) {
int a = 0;
if (a >= 0) {
System.out.println(">= 0");
if (a != 0) {
System.out.println("!= 0");
}
} else {
System.out.println("< 0");
View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@ryan0x44
ryan0x44 / Terraform-Blue-Green-AWS.md
Created Nov 19, 2015
Blue-Green AWS Auto Scaling Deployments with Terraform
View Terraform-Blue-Green-AWS.md

A quick note on how I'm currently handling Blue/Green or A/B deployments with Terraform and AWS EC2 Auto Scaling.

In my particular use case, I want to be able to inspect an AMI deployment manually before disabling the previous deployment.

Hopefully someone finds this useful, and if you have and feedback please leave a comment or email me.

Overview

I build my AMI's using Packer and Ansible.

You can’t perform that action at this time.