Skip to content

Instantly share code, notes, and snippets.

View daidokoro's full-sized avatar
👀
To Go or to Rust......? That is the question.

Shaun Remekie daidokoro

👀
To Go or to Rust......? That is the question.
View GitHub Profile
@daidokoro
daidokoro / sgs
Last active May 29, 2020 13:07
cfn-tmp
{{- if eq .name "efs" }}
Resources:
filesystem:
Type: AWS::EFS::FileSystem
Properties:
Encrypted: {{ .stack.encrypt }}
{{- if .stack.encrypt }}
KmsKeyId: !GetAtt
- key
- Arn
@daidokoro
daidokoro / main.go
Created July 8, 2019 01:43
List Google Cloud Platform IP Address Ranges - Golang
/*
This package contains a simple Go code
for acquiring the IP Address Ranges utilised by Google Cloud Platform.
This process is based on documentation provided by Google
see: https://cloud.google.com/compute/docs/faq#find_ip_range
Author: Shaun Remekie
Email: [email protected]
*/
@daidokoro
daidokoro / python_batch.py
Created April 11, 2019 08:44
Beam Stuff
'''
Apache Beam Python Batch Example
'''
class Batch(beam.DoFn):
"""
Batch - batch items from PCollection
"""
def __init__(self, n):
import json
@daidokoro
daidokoro / http_get.js
Created September 7, 2018 09:41
Quick HTTP Get Function for Javascript
function httpGet(theUrl)
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
xmlHttp.send( null );
return xmlHttp.responseText;
}
from google.cloud import bigquery
# create a client
client = bigquery.Client().from_service_account_json('<your-JSON-key.json>')
# create a query
q = "select * from dataset.table"
# run query
rows = client.query(q)
@daidokoro
daidokoro / futures.py
Last active July 5, 2017 17:04
concurrent_futures_example
from concurrent.futures import ThreadPoolExecutor, as_completed
import time, random
class Jobs(object):
# create queue
queue = ThreadPoolExecutor(max_workers=4)
jobs = []
@staticmethod
@daidokoro
daidokoro / mfa_session_token.py
Last active June 26, 2017 16:46
MFA Session Token
from boto3 import Session
from sys import argv
from os import unlink, path
serial = "arn:aws:iam::<Account Number>:mfa/<Username>"
profile = "<your aws config source profile here>"
credfile = os.path.join(os.getenv("HOME"), ".aws/credentials")
def set_creds(token):