Skip to content

Instantly share code, notes, and snippets.

@ProbablyRusty
ProbablyRusty / spiral-ascension.swift
Last active June 19, 2017 15:08
Swift Spiral Ascension
// In reference to:
// https://www.reddit.com/r/dailyprogrammer/comments/6i60lr/20170619_challenge_320_easy_spiral_ascension/
let input = 5
enum Direction {
case right, down, left, up
mutating func turn() {
switch self {
@ProbablyRusty
ProbablyRusty / condensing-sentences.swift
Created June 19, 2017 05:17
Swift Condensing Sentences
// In reference to:
// https://www.reddit.com/r/dailyprogrammer/comments/6grwny/20170612_challenge_319_easy_condensing_sentences/
let input = """
Deep episodes of Deep Space Nine came on the television only after the news.
Digital alarm clocks scare area children.
"""
var lines = input.split(separator: "\n")
@ProbablyRusty
ProbablyRusty / concatenated-integers.swift
Last active June 18, 2017 22:32
Swift Concatenated Integers
// In reference to:
// https://www.reddit.com/r/dailyprogrammer/comments/69y21t/20170508_challenge_314_easy_concatenated_integers/
let input = """
79 82 34 83 69
420 34 19 71 341
17 32 91 7 46
"""
func pad (_ strToPad: String, maxLength: Int) -> String {
@ProbablyRusty
ProbablyRusty / aws-windows-zerotier-demo.tf
Last active February 21, 2024 00:00
Example of using Terraform to automate ZeroTier installation and network joins for Windows EC2 instances
# I recently needed to automate the process of spinning up Windows EC2 instances
# in AWS, installing ZeroTier, and then joining them to a ZeroTier network. I
# used Terraform to do this. This example might help others. If you provide an
# existing subnet, security group, ZeroTier network ID, and a few other details
# via Terraform variables, this template will create one demo Windows instance
# in AWS, install ZeroTier, and join the instance to the specified ZeroTier
# network.
variable "aws_region" {
description = "AWS Region where this instance will be deployed (ie: us-east-1)"