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 ruby | |
# Usage: CLOUDFLARE_TOKEN=[...] ./set_min_tls_version.rb | |
# Supplied token requires permissions zone:read and zone_settings:edit. | |
require 'faraday' | |
require 'json' | |
# ultra-minimal cloudflare api wrapper to make it easy to follow API docs: https://api.cloudflare.com/ | |
CLOUDFLARE_API_HOST = 'api.cloudflare.com' |
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
def dig(hostname, ip_addresses_only = true, ipv6 = false) | |
if ipv6 | |
io = IO::Memory.new | |
Process.run("dig", [hostname, "AAAA", "+short"], output: io, shell: true) | |
output = io.to_s.lines | |
ip_addresses_only ? output.select { |s| s =~ /^[0-9a-f]+[:0-9a-f]+$/ } : output | |
else | |
io = IO::Memory.new | |
Process.run("dig", [hostname, "A", "+short"], output: io, shell: true) | |
output = io.to_s.lines |
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: link_local_shard ../myshard | |
# | |
# Run from target project root. Deletes existing dir in lib (presumably | |
# added by shards) and replaces with a symlink to the path you provide. | |
# | |
if [ ! -d ./lib ]; then |
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
class User | |
include Dynamoid::Document | |
attr_reader :password | |
attr_accessor :password_confirmation | |
field :username | |
field :email_address | |
field :password_hash | |