This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DOCKER_HOSTS_FILE="$HOME/tmp/docker-hosts" | |
HOSTS_NEW_FILE="$HOME/tmp/hosts.new" | |
# Get the list of running containers | |
CONTAINER_IDS=$(docker ps -q) | |
# Clear the current Docker hosts file | |
echo "# Docker container IPs" > $DOCKER_HOSTS_FILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="async-await-blocking"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk') | |
let params = { | |
InstanceIds: [ | |
"i-something" | |
] | |
}; | |
let route53params = { | |
"HostedZoneId": "", // zone id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
instanceId="i-something" | |
aws ec2 stop-instances --instance-ids $instanceId; | |
aws ec2 wait instance-stopped --instance-ids $instanceId; | |
aws ec2 start-instances --instance-ids $instanceId; | |
aws ec2 wait instance-running --instance-ids $instanceId; | |
echo "machine running" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
usage() { | |
cat << EOF | |
Usage: $0 [OPTION]... COMMAND | |
Execute the given command in a way that works safely with cron. This should | |
typically be used inside of a cron job definition like so: | |
* * * * * $(which "$0") [OPTION]... COMMAND | |
Arguments: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Notations | |
.. - enumeration | |
:: - It's not really a notation but still... x :: y means "the expression x has the type y" | |
- Alternatively, from Real World Haskell "The combination of :: and the type after it is called a type signature." | |
lines :: String -> [String] | |
We can read the -> above as “to”, which loosely translates to “returns”. The signature as a whole thus reads as “lines has the type String to list-of-String”. Let's try applying the function. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Run Firefox with WebRTC debugging. | |
# - Signaling (SDP) logs go to SIGNALING_FILE. | |
# - ICE/STUN/TURN logs go to stderr. | |
# | |
FIREFOX_EXEC=/Applications/Firefox.app/Contents/MacOS/firefox | |
SIGNALING_FILE=/tmp/firefox_signaling.log |