Skip to content

Instantly share code, notes, and snippets.

View thanandorn's full-sized avatar

Thanandorn Thongsringklee thanandorn

View GitHub Profile
COLUMNS = [ 'a', 'b', 'c' ]
with beam.Pipeline(options=PipelineOptions()) as p:
csv_pc = ( p | 'ReadCSVFromGCS' >> beam.io.ReadFromText(file_pattern='./data/filename.csv.gz', compression_type='gzip')
| 'SplitData' >> beam.Map(lambda x: x.split(','))
| 'ConvertToDict' >> beam.Map(lambda x: dict(zip(COLUMNS, x)))
| 'Print' >> beam.Map(print))
# Delete All Failed/Evicted Pods
kubectl get pod -A --field-selector="status.phase==Failed"
kubectl delete pod -A --field-selector="status.phase==Failed"
curl 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fmanagement.azure.com%2F' -H Metadata:true -s
#!/bin/bash
cat << EOF >userlist.txt
John
William
James
Charles
George
Frank
Joseph
@thanandorn
thanandorn / gke-tiller-per-ns.md
Last active October 12, 2018 08:46
Tiller per namespaces on GKE

tiller.yaml

---
kind: Namespace
apiVersion: v1
metadata:
  name: NAMESPACE
  labels:
    name: NAMESPACE
---
@thanandorn
thanandorn / aws_security_group_details.sh
Last active September 24, 2018 20:17 — forked from gh-mlfowler/aws_security_group_details.sh
A quick and dirty script to list out all security group settings on an AWS account. Barely tested, use at own risk, etc. Requires awscli to be installed.
#!/bin/bash
# Requires: awscli (http://aws.amazon.com/cli/)
# Prints out a list of all security groups and their settings, just for quickly auditing it.
# Want to do this for all regions...
REGIONS=(`aws ec2 describe-regions --region us-west-1 --output text | grep "-" | awk -F $'\t' '{print $3}'`)
for REGION in ${REGIONS[*]}; do
echo "=> $REGION"
# Grab all the security group info for this region in one call.
@thanandorn
thanandorn / aws_security_group_details.sh
Created June 22, 2018 12:38 — forked from gh-mlfowler/aws_security_group_details.sh
A quick and dirty script to list out all security group settings on an AWS account. Barely tested, use at own risk, etc. Requires awscli to be installed.
#!/bin/bash
# Requires: awscli (http://aws.amazon.com/cli/)
# Prints out a list of all security groups and their settings, just for quickly auditing it.
# Want to do this for all regions...
REGIONS=(`aws ec2 describe-regions --region us-west-1 --output text | grep "-" | awk -F $'\t' '{print $3}'`)
for REGION in ${REGIONS[*]}; do
echo "=> $REGION"
# Grab all the security group info for this region in one call.

Keybase proof

I hereby claim:

  • I am thanandorn on github.
  • I am thanandorn (https://keybase.io/thanandorn) on keybase.
  • I have a public key whose fingerprint is 1ABC A19C 5BD8 9511 C225 58BE 1C64 824C 3BDC 5C87

To claim this, I am signing this object:

@thanandorn
thanandorn / lvm-fixes-on-centos5.md
Last active October 12, 2018 08:49
LVM on /dev/md127 fixes on CentOS5

LVM on /dev/md127 fixes on CentOS5

+---------------------------+
|        LVM Volumes        |
+---------------------------+
|     /dev/md1 (raid1)      |
+-------------+-------------+
|  /dev/sda2  |  /dev/sdb2  |
+-------------+-------------+