This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Deque; | |
import java.util.Iterator; | |
import java.util.ArrayDeque; | |
public class ExtendableIterator<T> implements Iterator<T> { | |
public Deque<Iterator<T>> its = new ArrayDeque<Iterator<T>>(); | |
public ExtendableIterator() { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import inspect | |
def whoami(): | |
'''Return the module name of where the call came from.''' | |
frame_records = inspect.stack()[1] | |
calling_module = inspect.getmodulename(frame_records[1]) | |
return calling_module | |
# Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# docker aliases | |
alias drmv='docker volume ls -qf dangling=true | xargs -r docker volume rm' | |
alias drmi='docker images --filter dangling=true -q | xargs -r docker rmi' | |
alias drmc='docker ps -q -f status=exited | xargs -r docker rm' | |
alias drm='drmc;drmi;drmv' | |
alias docker-clean='docker-compose stop && drm' | |
alias docker-names='docker ps | cut -d " " -f1 | tac | head -n-1' | |
#alias dip="docker inspect --format '{{ .NetworkSettings.IPAddress }}'" $@ | |
alias dip="docker ps --format=\"{{.Names}}\" | xargs docker inspect --format '{{.Name}} {{ .NetworkSettings.IPAddress }}' | column -t -s\" \"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import boto | |
import math | |
# Use boto to Copy an Object greater than 5 GB Using S3 Multipart Upload API | |
# probably could be made more pythonesque, based directly off the AWS Java example | |
# Copy an Object [greater than 5 GB] Using the AWS SDK for Java [S3] Multipart Upload API | |
# http://docs.aws.amazon.com/AmazonS3/latest/dev/CopyingObjctsUsingLLJavaMPUapi.html | |
# copy in same bucket as a simple test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def skip(iterator, n): | |
""" | |
skip n items in iterator | |
from itertools recipes: | |
https://docs.python.org/3/library/itertools.html#itertools-recipes | |
(see "consume") | |
:param iterator: iterator to skip | |
:param n: items to skip | |
:return: iterator with n items skipped |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import chain | |
import inspect | |
# very naive deastruct implementation (not native...) | |
def _destruct(selector): | |
def _(value): | |
if isinstance(selector, dict): | |
yield from chain.from_iterable(_destruct(selector[k])(value[k]) for k in selector) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Computer Information: | |
Manufacturer: Apple | |
Model: iMac19,1 | |
Form Factor: Desktop | |
No Touch Input Detected | |
Processor Information: | |
CPU Vendor: GenuineIntel | |
CPU Brand: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz | |
CPU Family: 0x6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: my-ingress | |
annotations: | |
# provision application load balancer | |
kubernetes.io/ingress.class: alb | |
# on a public subnet | |
alb.ingress.kubernetes.io/scheme: internet-facing | |
# register pods to Load Balancer (not nodes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
annotations: | |
service.beta.kubernetes.io/aws-load-balancer-type: nlb-ip | |
name: my-nlb | |
spec: | |
ports: | |
- port: 80 | |
protocol: TCP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
annotations: | |
service.beta.kubernetes.io/aws-load-balancer-type: nlb-ip | |
service.beta.kubernetes.io/aws-load-balancer-target-group-attributes: proxy_protocol_v2.client_to_server.header_placement=on_first_ack,proxy_protocol_v2.enabled=true | |
name: my-nlb | |
spec: | |
ports: | |
- port: 80 |
OlderNewer