Skip to content

Instantly share code, notes, and snippets.

@kenoir
kenoir / mount_nvme_ec2
Last active November 11, 2020 10:58
Mount NVMe from AWS i3 instance on Amazon Linux
# Identify nvme_drive
lsblk
# Mount the drive
sudo mkfs -t xfs /dev/nvme_drive
sudo mkdir /data
sudo mount /dev/nvme_drive /data
sudo chown ec2-user /data
# Checkout a fresh copy of the repo you want to pull the code from
git clone [email protected]:wellcomecollection/scala-SOMELIB.git
# Move into the freshly checked repo
cd scala-SOMELIB
# Filter history for a particular directory
git filter-branch --subdirectory-filter SOMELIB -- --all
# Rearrange things as you'd like them
@kenoir
kenoir / userdata.sh
Last active June 12, 2020 07:34
Quick setup EC2 Linux for storage service work
#!/bin/bash
sudo yum update -y
# Setup docker
sudo amazon-linux-extras install docker
sudo service docker start
sudo usermod -a -G docker ec2-user
# Setup docker-compose
sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
@kenoir
kenoir / sync_hosted_zones.py
Created June 4, 2020 16:23
This script can be used to sync and confirm record sets between Route53 Hosted Zones.
#!/usr/bin/env python3
"""
This script can be used to sync and confirm record sets between Route53 Hosted Zones.
"""
from pprint import pprint
import uuid
import boto3
import click
package things
import java.time.Instant
import com.sksamuel.avro4s.AvroSchema
import org.apache.avro.Schema
object World extends App {
sealed trait User {
Flock flock;
void setup() {
size(800, 800);
flock = new Flock();
// Add an initial set of boids into the system
for (int i = 0; i < 350; i++) {
flock.addBoid(new Boid(width/2,height/2));
}
}
float x,y,z,w,h,rotationX,rotationY;
int step;
void setup() {
size(800,800,P3D);
x = width/2;
y = height/2;
z = -100;
#!/usr/bin/env bash
# ~/.azuresso
#
# {
# "AZURE_USER_ID": "user@domain"
# "AZURE_TENANT_ID" : "11111111-1111-1111-11111111111",
# "AZURE_APP_ID_URI" : "11111111-1111-1111-11111111111"
# }
#
object ErrorStates {
// Type alias to string so it compiles
type Input = String
type Output = String
sealed trait ErrorState[Context] {
val err: Option[Throwable]
val ctx: Context
}
import math
def _distance(x1, y1, x2, y2):
adj = x1 - x2
opp = y1 - y2
return math.sqrt(math.pow(adj,2) + math.pow(opp,2))
def _angle(adj, opp):
#print(f"adj: {adj} ,opp: {opp}")