Skip to content

Instantly share code, notes, and snippets.

View jg75's full-sized avatar

James Garner jg75

  • Amber Engine
  • Michigan
View GitHub Profile
"""A silly test."""
import argparse
import inspect
import timeit
def parse_args(args=None, description=__doc__):
"""Parse input arguments."""
parser = argparse.ArgumentParser(description=description)
@jg75
jg75 / search.ts
Created June 26, 2018 20:39
another typescript example
function search(text:string, pattern:string): number {
let i:number = 0
let j:number = 0
for (i = 0; i < text.length; i++) {
for (j = 0; j < pattern.length && i + j < text.length; j++) {
if (text.charAt(i + j) != pattern.charAt(j)) {
break
}
}
interface Greeter {
greet: ()=>string
}
var helloWorld:Greeter = {
greet: ():string =>{return "Hello World"}
}
console.log(helloWorld.greet())
@jg75
jg75 / subnet.py
Created June 18, 2018 13:50
A CIDR IP address calculator
"""A subnet IP address range calculator."""
import argparse
import copy
import math
class Subnet:
"""A subnet."""
@staticmethod
"""Kinesis data streams example how-to."""
import datetime
import logging
import time
import botocore
import boto3
logging.basicConfig(level=logging.INFO)
"""An AWS SNS example."""
import logging
import time
import boto3
logging.basicConfig(
level=logging.INFO,
format='[%(asctime)s] %(levelname)s:%(name)s:%(message)s'
@jg75
jg75 / compare.py
Created April 23, 2018 14:28
A stupid experiment to see which is faster
"""A stupid experiment to see which is faster."""
import inspect
import os
import tempfile
import timeit
def get_contents_exists(path):
"""Test if the path exists and return its contents.
"""Listens to an SNS Queue and pops messages."""
from multiprocessing import Process
import boto3
sqs = boto3.client("sqs")
queue_url = ""
visibility_timeout = 30
wait_percent = 0.8
from __future__ import print_function
import boto3
import botocore
import json
import logging
import urllib2
from base64 import b64decode
from datetime import datetime
import getopt
import math
import sys
db_iops_limits = {
"aurora": {
"MinimumStorage": 100,
"MaximumStorage": 6000,
"TheoreticalMaximumIOPS": 30000