Skip to content

Instantly share code, notes, and snippets.

View sepulworld's full-sized avatar
🤘

Zane Williamson sepulworld

🤘
View GitHub Profile
@sepulworld
sepulworld / openai.go
Created December 4, 2022 04:53
chat with openai
package main
import (
"bufio"
"fmt"
"os"
"time"
"github.com/openai/api-client-go/openai"
)
@sepulworld
sepulworld / dyanmodb_table_012.tf
Last active April 9, 2019 19:14
dyanmodb_table_012.tf
// Testing this stand alone first. Ideally, this would go into our module (where dynamic contenct generation makes sense for us)
// This matches up with what I see in the docs, and here https://www.hashicorp.com/blog/hashicorp-terraform-0-12-preview-for-and-for-each
// However, I get the following errors on attributes that should exist for these content blocks
/*
Error: Unsupported attribute
on test.tf line 59, in resource "aws_dynamodb_table" "dynamodb_table":
59: projection_type = global_secondary_index.projection_type
@sepulworld
sepulworld / elasticache-tag-bug-issue-5021.txt
Created September 13, 2018 17:53
elasticache-tag-bug-issue-5021
-----BEGIN PGP MESSAGE-----
Version: Keybase OpenPGP v2.0.77
Comment: https://keybase.io/crypto
wcBMA9X0O2Qy6nfzAQgAiU9deK3voaiZa061Zm5hV8Yf67rpY8Ge3x3F896lkhdf
omsPM+RKn2em9WGhi2+3Umx2sSexeiar3cu8MyKsrO+VZS2e8TE11omYmuM5zF1c
AglNKxQ+i57x+tT3i2Qp01mvub3CrKLx/ac/SBsQHATOI+8vpcOmQdWKUdv6r1U9
qanjMnqs4xWIG0ysxbzDU6mkGRCAMTJO/aWAHYzWze+nLzOnSgbJVArzoUdSnvQ5
grIUltxoc2l8VMSpxiAEm+64+ANbgY7UX9DhHsNf8I1OQVe60BccPZYQetyBSkCZ
NULlh+E5tXA5hE0zFmsQl6vuAdWzP6CVAIyQzpg6cdL/AABeHAHy3hy9JppKL84+
@sepulworld
sepulworld / wordcount.py
Created November 22, 2017 22:06
Word Count Spark
from __future__ import print_function
from pyspark import SparkContext
import sys
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: wordcount ", file=sys.stderr)
exit(-1)
sc = SparkContext(appName="WordCount")
text_file = sc.textFile(sys.argv[1])
counts = text_file.flatMap(lambda line: line.split(" ")).map(lambda word: (word, 1)).reduceByKey(lambda a, b: a + b)
ipurcbasefc for tbe Sltbrars of
be TUniverait? of {Toronto
out of tbe proceeds of tbe fun&
bequeatbefc bp
@sepulworld
sepulworld / fib_list.py
Created November 9, 2017 20:50
Fibonacci_list
def fibonacci(max):
x, y = 0, 1
while x < max:
yield x
x, y = y, x + y
fib_list = [n for n in fibonacci(1000)]
print("here is the fib_list: {}".format(fib_list))
curl 127.0.0.1:9292/tfsoa/add_tf_state -H "Content-Type: application/json" -X \
POST -d '{"role_arn": "arn:aws:iam::357170183134:role/s3read","s3_bucket_name": "terraform-autozane-remote-state","s3_bucket_key": "autozane_kafka_awslogs_cloudwatch/promotion/Terraform"}'
curl 127.0.0.1:9292/tfsoa/add_tf_state -H "Content-Type: application/json" -X \
POST -d '{"role_arn": "arn:aws:iam::357170183134:role/s3read","s3_bucket_name": "terraform-autozane-remote-state","s3_bucket_key": "autozane_aptly_awslogs_cloudwatch/promotion/Terraform"}'
curl 127.0.0.1:9292/tfsoa/add_tf_state -H "Content-Type: application/json" -X \
POST -d '{"role_arn": "arn:aws:iam::357170183134:role/s3read","s3_bucket_name": "terraform-autozane-remote-state","s3_bucket_key": "golang-app-dev/promotion/Terraform"}'
curl 127.0.0.1:9292/tfsoa/add_tf_state -H "Content-Type: application/json" -X \
@sepulworld
sepulworld / tfenv.rb
Created September 11, 2016 21:33
Chef to setup tfenv on Jenkins
execute 'apt-get update'
package ['unzip']
git '/var/lib/jenkins/tfenv' do
repository 'https://github.com/kamatama41/tfenv.git'
revision 'master'
action :sync
user 'jenkins'
group 'jenkins'
@sepulworld
sepulworld / asg.tf
Last active September 2, 2016 19:35
Terraform ASG and Launch Config
resource "aws_launch_configuration" "lc" {
lifecycle { create_before_destroy = true }
image_id = "${var.ami_version}"
instance_type = "${var.instance_type}"
iam_instance_profile = "${var.service_name}-${var.environment}"
key_name = "${var.key_name}"
security_groups = ["${aws_security_group.sg1.id}"]
user_data = "user-data.sh"
@sepulworld
sepulworld / service-watchdog.sh
Created September 2, 2016 19:01
Service-watchdog
#!/bin/bash
# First arg should be the systemd service to watch
# Requires cloud-utils apt package and pip awscli
# Requires IAM access to IAM action autoscaling:SetInstanceHealth
EC2_INSTANCE_ID=$(ec2metadata --instance-id)
PROCESS_CHECK=$1
REGION=$2
while :