Skip to content

Instantly share code, notes, and snippets.

View clstokes's full-sized avatar
☁️

Cameron Stokes clstokes

☁️
View GitHub Profile
@clstokes
clstokes / pasteboard_scrubber.lua
Last active November 17, 2022 21:30
A Hammerspoon (https://www.hammerspoon.org/) script to scrub tracking variables from Twitter share links in your pasteboard (clipboard).
function pasteboard_scrubber(copied_value)
local t_match = "^(https://twitter.com/[a-zA-Z0-9_]+/status/[0-9a-zA-Z]+)[?]+.+$"
local _, _, matched_value = string.find(copied_value, t_match)
if matched_value ~= nil then
-- Replace URL in pasteboard
hs.pasteboard.writeObjects(matched_value)
end
end
@clstokes
clstokes / index.ts
Created March 26, 2020 00:04 — forked from kevink/index.ts
Test Script for AWS infra
// Copyright 2016-2019, Pulumi Corporation. All rights reserved.
import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";
import * as pulumi from "@pulumi/pulumi";
//import { VpcEndpointService } from "@pulumi/aws/ec2";
// ****************************************************************************************************************************************
// Grab some secrets from our config file
// ****************************************************************************************************************************************
@clstokes
clstokes / index.ts
Created December 3, 2018 22:43
Pulumi Example: Create multiple AWS IAM Roles.
import * as aws from "@pulumi/aws";
const assumeRolePolicyDocument = JSON.stringify({
Version: "2012-10-17",
Statement: [{
Action: "sts:AssumeRole",
Principal: {
Service: "ec2.amazonaws.com"
},
Effect: "Allow",
@clstokes
clstokes / assume-role-policy.json
Last active September 1, 2022 20:15
Example: Terraform IAM Role
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
@clstokes
clstokes / iam.tf
Last active December 3, 2017 15:31
variable "role_name" {}
variable "role_policy_file" {}
resource "aws_iam_role" "role" {
name = "${var.role_name}"
assume_role_policy = "${file("${path.module}/policies/${var.role_policy_file}")}"
}
output "role_arn" {
value = "${aws_iam_role.role.arn}"
### Keybase proof
I hereby claim:
* I am clstokes on github.
* I am clstokes (https://keybase.io/clstokes) on keybase.
* I have a public key whose fingerprint is B970 5386 3BE3 EAE8 446A 1FA8 AAC4 B68D A32C 32D4
To claim this, I am signing this object:
@clstokes
clstokes / gist:07ad4202a3fa6c627df4
Last active November 13, 2015 22:16
🐛 Terraform: No ingress rules were found...
clstokes-mbpro:consul-cluster clstokes$ terraform apply aws-nat-consul-cluster/terraform/
atlas_artifact.consul: Refreshing state... (ID: us-east-1:ami-fa522a90,us-west-2:ami-9b4150fa)
atlas_artifact.consul_client: Refreshing state... (ID: us-east-1:ami-0e5f2764,us-west-2:ami-35435254)
template_file.consul_update: Refreshing state... (ID: d82b4576930c7fe3d4a263ba5b15ed833c1cd9e5b984b1c9b92447dff46a2459)
aws_vpc.main: Refreshing state... (ID: vpc-36b13452)
aws_key_pair.main: Refreshing state... (ID: atlas-example)
aws_subnet.subnet_b: Refreshing state... (ID: subnet-dd7077f6)
aws_subnet.subnet_c: Refreshing state... (ID: subnet-803eccf6)
aws_security_group.admin_access: Refreshing state... (ID: sg-4d38a62b)
aws_security_group.consul: Refreshing state... (ID: sg-4c38a62a)
@clstokes
clstokes / do-ubuntu.json
Last active November 10, 2015 18:53
📝 Working HashiCorp Atlas and DigitalOcean example.
{
"variables": {
"region": "nyc2",
"source_image": "ubuntu-14-04-x64",
"atlas_username": "{{ env `ATLAS_USERNAME` }}",
"atlas_name": "digitalocean-example"
},
"builders": [{
"type": "digitalocean",
"image": "{{user `source_image`}}",
@clstokes
clstokes / output
Last active August 29, 2015 14:23
main.tf
provider "aws" {
access_key = "ASDF"
secret_key = "ASDF"
region = "us-east-1"
}
resource "aws_security_group" "no_modifications_single_ingress" {
name = "no_modifications_single_ingress"
description = "this security group causes NO modifications each run"
@clstokes
clstokes / gist:5a107c30f88eac4057de
Created May 18, 2015 20:23
terraform variables and split function
variable "subnet_cidr_blocks" {
default = "192.168.0.0/24,192.168.1.0/24,192.168.2.0/24"
}