Skip to content

Instantly share code, notes, and snippets.

View fancyremarker's full-sized avatar

Frank Macreery fancyremarker

  • Aptible
  • Catskill Mountains
View GitHub Profile
@fancyremarker
fancyremarker / solve.rb
Last active January 7, 2024 23:48
Letter Boxed solver
require 'tempfile'
WORDS_FILE = 'words.txt'.freeze
SOLUTIONS_FILE = 'solutions.txt'.freeze
def unique_letters_for_words(words)
words.join.split('').uniq.sort.join
end
# Ex: verify_solution_against_puzzle(['DISTURB', 'BLACKJACK'], ['JLI', 'CUD', 'BTK', 'ASR'])
@fancyremarker
fancyremarker / redirect.json
Last active August 5, 2023 12:12
Redirect all requests to a different static URL
{
"AWSTemplateFormatVersion": "2010-09-09",
"Outputs": {
"DistributionHostname": {
"Description": "Use this domain name in your DNS provider.",
"Value": {
"Fn::GetAtt": [
"RootDistribution",
"DomainName"
]
@fancyremarker
fancyremarker / aptible_s3_bucket.tf
Created September 22, 2022 21:32
Exploded asset bundle for S3
resource "aws_s3_bucket" "b" {
bucket = "my-tf-test-bucket-{random_string.suffix.id}"
}
resource "random_string" "suffix" {
length = 20
special = false
upper = false
}
# Our product relies on SSH for authentication and transport in various parts
# of the app. Most operations generate a certificate with particular
# restrictions to constrain what the user can do once they're authenticated to
# the SSH portal.
# The Core API would be making the permission decisions (i.e.
# what force command to use, whether to allocate port forwarding), and this
# module is responsible for providing a corresponding SSH Certificate.
# For example: DB Tunnel operations are allowed to port-forward, but they're
@fancyremarker
fancyremarker / print_puzzle_stats.rb
Created October 5, 2020 21:19
Print stats for NYT crossword completion
require 'net/http'
require 'time'
require 'json'
require 'uri'
TOKEN = File.read('nyt-s.token').rstrip
API_BASE = 'https://nyt-games-prd.appspot.com/svc/crosswords'
DELAY = 0.1
AWSTemplateFormatVersion: '2010-09-09'
Description: |
Template for a CloudFront distribution that serves Secure Headers
Parameters:
Domain:
Type: String
Description: |
CNAME at which CloudFront distribution will be served (e.g., foobar.com)
@fancyremarker
fancyremarker / cleanup-deactivated-slack-users.rb
Created September 21, 2017 00:40
Clean up deactivated Slack users from shared channels
require 'json'
BASE_URL = 'https://slack.com/api'
TOKEN = ENV['SLACK_TOKEN']
BACKOFF = 0.2
channels_url = "#{BASE_URL}/conversations.list?token=#{TOKEN}"
channels = JSON.parse(`curl -s '#{channels_url}'`)['channels']
sleep BACKOFF
@fancyremarker
fancyremarker / yubikey-ssh.md
Last active October 2, 2019 13:30
YubiKey Setup Notes (Draft)

Requirements

This configuration assumes you have:

  • A YubiKey that supports OpenPGP (4, 4 Nano, 4C, or NEO)
  • GPGTools (I couldn't get PIN entry, which is required for interfacing to work with any other GPG's version of pinentry)

Setup

  1. Insert YubiKey into USB port.
@fancyremarker
fancyremarker / keybase.md
Created December 4, 2016 23:26
Keybase Proof of GitHub Identity

Keybase proof

I hereby claim:

  • I am fancyremarker on github.
  • I am fancyremarker (https://keybase.io/fancyremarker) on keybase.
  • I have a public key whose fingerprint is B98E 8DFD 8FED 629F 5BA3 BC17 CDE8 5C7F F0C9 12C2

To claim this, I am signing this object:

@fancyremarker
fancyremarker / Dockerfile
Last active April 2, 2016 15:59
Template repo for deploying MongoDB Cloud Monitoring (MMS) agent on Aptible
FROM quay.io/aptible/ubuntu:14.04
WORKDIR /tmp
RUN apt-install curl
RUN curl -OL https://cloud.mongodb.com/download/agent/monitoring/mongodb-mms-monitoring-agent_4.1.0.251-1_amd64.deb && \
dpkg -i mongodb-mms-monitoring-agent_4.1.0.251-1_amd64.deb && \
rm -rf mongodb-mms-monitoring-agent_4.1.0.251-1_amd64.deb
ADD start-monitoring-agent /usr/local/bin/