- hackmd version: https://hackmd.io/1eeNAS1oQuSvMA0q6y_QuA?view
- gist version: https://gist.github.com/bluet/23e7697b86144561c4a3d804903d059d
[TOC]
- Extract 部份:取出要的資料、去雜訊、資料標準化、parsing...
- Transform:aggregation、mapping 、combined、Change Data Types
#!/bin/bash | |
# This script cleans up your EC2 instance before baking a new AMI. | |
# Run the following command in a root shell: | |
# | |
# bash <(curl -s https://gist.github.com/justindowning/5921369/raw/ami-clean.sh) | |
function print_green { | |
echo -e "\e[32m${1}\e[0m" | |
} |
-- Table information like sortkeys, unsorted percentage | |
-- see http://docs.aws.amazon.com/redshift/latest/dg/r_SVV_TABLE_INFO.html | |
SELECT * FROM svv_table_info; | |
-- Table sizes in GB | |
SELECT t.name, COUNT(tbl) / 1000.0 AS gb | |
FROM ( | |
SELECT DISTINCT datname, id, name | |
FROM stv_tbl_perm | |
JOIN pg_database ON pg_database.oid = db_id |
[TOC]
############################################################################### | |
# Helpful Docker commands and code snippets | |
############################################################################### | |
### CONTAINERS ### | |
docker stop $(docker ps -a -q) #stop ALL containers | |
docker rm -f $(docker ps -a -q) # remove ALL containers | |
docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter | |
# exec into container |
############################################################################### | |
# Helpful Git/GitHub commands and code snippets | |
############################################################################### | |
#### Remove/Squash All History on Master - CAUTION! #### | |
# https://stackoverflow.com/a/26000395/580268 | |
git checkout --orphan latest_branch \ | |
&& git add -A \\ | |
&& git commit -am "Remove/squash all project history" \ | |
&& git branch -D master \ |
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
"""Template for python3 terminal scripts. | |
This gist allows you to quickly create a functioning | |
python3 terminal script using argparse and subprocess. | |
""" | |
import argparse |
[Container]
{ | |
"Version": "2012-10-17", | |
"Statement": [{ | |
"Action": "ec2:*", | |
"Effect": "Allow", | |
"Resource": "*", | |
"Condition": { | |
"StringEquals": { | |
"ec2:Region": [ | |
"us-east-1", |
Tags: | |
- Key: Name | |
Value: | |
!Join ['_', [ ec2, "Fn::ImportValue" : {"Fn::Sub":'${BaseStackName}-Environment'}, test2]] | |
#This will create a name tag with value: ec2_<yourValueFromOtherStack>_test2 |
{ | |
"name": "jdbc_source_mysql_foobar_01", | |
"config": { | |
"_comment": "The JDBC connector class. Don't change this if you want to use the JDBC Source.", | |
"connector.class": "io.confluent.connect.jdbc.JdbcSourceConnector", | |
"_comment": "How to serialise the value of keys - here use the Json converter. We want to retain the schema in the message (which will generate a schema/payload JSON document) and so set schemas.enable=true", | |
"key.converter": "org.apache.kafka.connect.json.JsonConverter", | |
"key.converter.schemas.enable":"true", |