Skip to content

Instantly share code, notes, and snippets.

View fionn's full-sized avatar
🦜
wars are waged by technicians

Fionn Fitzmaurice fionn

🦜
wars are waged by technicians
View GitHub Profile
@fionn
fionn / bastion_vpc.tf
Last active September 30, 2020 08:45
VPC with public and private EC2 instances
locals {
common_tags = {
Description = "VPC with public and private EC2 instances",
Env = "dev",
Project = "bastion-vpc"
}
}
resource "aws_vpc" "ami_exp" {
cidr_block = "10.0.0.0/16"
@fionn
fionn / arch_ec2.tf
Last active May 5, 2020 09:04
Deploy the latest Arch Linux AMI on EC2
data "aws_ami" "arch" {
owners = ["093273469852"] # Uplink Labs
most_recent = true
filter {
name = "name"
values = ["arch-linux-hvm-*"]
}
filter {
@fionn
fionn / Makefile
Last active April 30, 2020 15:30
Simple Container
.PHONY: all
all: config.json rootfs
config.json:
sudo runc spec
busybox:
skopeo copy docker://busybox:latest oci:busybox:latest
bundle: busybox
@fionn
fionn / miller_rabin.py
Created April 30, 2020 14:19
Miller Rabin primality test
#!/usr/bin/env python3
from random import randint
def miller_rabin(n: int) -> bool:
if n <= 3 or n % 2 == 0:
raise RuntimeError("n <= 3 or n % 2 == 0")
k = 1
while (n - 1) % (1 << k) == 0 and ((n - 1) // (1 << k)) % 2 == 0:
@fionn
fionn / blackletter.txt
Created April 26, 2020 16:02
Blackletter
A: 𝔄
B: 𝔅
C: ℭ
D: 𝔇
E: 𝔈
F: 𝔉
G: 𝔊
H: ℌ
I: ℑ
J: 𝔍
@fionn
fionn / sars_cov_2.fasta
Created March 25, 2020 09:55
SARS-CoV-2
>MN908947.3 Severe acute respiratory syndrome coronavirus 2 isolate Wuhan-Hu-1, complete genome
ATTAAAGGTTTATACCTTCCCAGGTAACAAACCAACCAACTTTCGATCTCTTGTAGATCTGTTCTCTAAA
CGAACTTTAAAATCTGTGTGGCTGTCACTCGGCTGCATGCTTAGTGCACTCACGCAGTATAATTAATAAC
TAATTACTGTCGTTGACAGGACACGAGTAACTCGTCTATCTTCTGCAGGCTGCTTACGGTTTCGTCCGTG
TTGCAGCCGATCATCAGCACATCTAGGTTTCGTCCGGGTGTGACCGAAAGGTAAGATGGAGAGCCTTGTC
CCTGGTTTCAACGAGAAAACACACGTCCAACTCAGTTTGCCTGTTTTACAGGTTCGCGACGTGCTCGTAC
GTGGCTTTGGAGACTCCGTGGAGGAGGTCTTATCAGAGGCACGTCAACATCTTAAAGATGGCACTTGTGG
CTTAGTAGAAGTTGAAAAAGGCGTTTTGCCTCAACTTGAACAGCCCTATGTGTTCATCAAACGTTCGGAT
GCTCGAACTGCACCTCATGGTCATGTTATGGTTGAGCTGGTAGCAGAACTCGAAGGCATTCAGTACGGTC
GTAGTGGTGAGACACTTGGTGTCCTTGTCCCTCATGTGGGCGAAATACCAGTGGCTTACCGCAAGGTTCT
@fionn
fionn / lagrange_polynomial.py
Last active September 18, 2021 15:46
Lagrange polynomial
class LagrangePolynomial:
def __init__(self, x_points: list[float], y_points: list[float]) -> None:
self.xs = x_points
self.ys = y_points
def _basis(self, x: float, j: int) -> float:
"""Lagrange basis polynomial l_j(x)"""
x_j = self.xs[j]
product = 1.0
@fionn
fionn / bot@.service
Last active February 18, 2020 13:56
Systemd service unit templates for bots
# symlink to /etc/systemd/system/
[Unit]
Description=%I bot
After=network.target
[Service]
Type=simple
WorkingDirectory=/home/fionn/bots/%i/
EnvironmentFile=/home/fionn/bots/%i/.env
@fionn
fionn / remote_state_gcs.tf
Last active September 18, 2021 15:44
Store remote state on S3
locals {
project = "eng-sandbox"
region = "us-west1"
state_bucket_name = "test-terraform-state-2487523"
labels = {
env = "non-prod"
usage = "infra"
owned-by = "eng"
team = "test"
#!/bin/bash
#
# drawHelix.sh <input.fa>
#
# Reads a fasta input file and stream a B-Form DNA
# helix with the sequence to STDOUT
#
## __ __ __ ___
### |__) | / \ /__` \ / |\ | | /\ \_/
#### |__) | \__/ .__/ | | \| | /~~\ / \