Skip to content

Instantly share code, notes, and snippets.

View pingles's full-sized avatar

Paul Ingles pingles

View GitHub Profile
# /etc/cni/net.d/10-canal.conf
{
"name": "canal",
"type": "flannel",
"delegate": {
"type": "calico",
"etcd_endpoints": "...",
"log_level": "info",
"policy": {
"type": "k8s",
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": ...,
"Effect": "Allow",
"Action": [
"sts:GetSessionToken",
"iam:GetUser",
"iam:ListMFADevices"
export GCLOUD_PROJECT="source-project-id"
export GOOGLE_APPLICATION_CREDENTIALS="./service-account-key.json"
java -cp big-replicate-standalone.jar \
uswitch.big_replicate.sync \
--source-project source-project-id \
--source-dataset 98909919 \
--destination-project destination-project-id \
--destination-dataset 98909919 \
--table-filter "ga_sessions_\d+" \
coreos:
units:
- name: systemd-journald.service
drop-ins:
- name: 10-override-tty.conf
content: |
[Journal]
TTYPath=/dev/null
command: start
ERROR: F0417 13:59:03.614902 3144 create.go:50] Client error: Service "myservice" is invalid: spec.ports: required value
(defn download-report [{:keys [client date] :as state}]
;; snip
(assoc state :file downloaded-file))
(defn upload-to-s3 [{:keys [file] :as state}]
;; snip
(assoc state :bucket bucket :key key))
(defrecord Transition [op next-state])
(defn download-report [client date]
(try
;; snip
(catch Exception e
(Thread/sleep 10000)
(download-report client date))))
(defn upload-to-s3 [file]
(try
;; snip
(defn -main []
;; snip
(doseq [[date client] requests]
(try
(let [file (download-report client date)]
(upload-to-s3 file))
(catch Exception e
(log/error e)
(System/exit 1)))))
# memory profile
# $ sudo jmap -J-d64 -F -histo <PID>
num #instances #bytes Class description
--------------------------------------------------------------------------
1: 947931 162798664 char[]
2: 45135 106753792 byte[]
3: 214155 68806464 int[]
4: 895438 35817520 java.util.LinkedHashMap$Entry
select
cast(use2.usename as varchar(50)) as owner,
pgc.oid,
trim(pgdb.datname) as Database,
trim(pgn.nspname) as Schema,
trim(a.name) as Table,
b.mbytes,
a.rows
from
(select db_id, id, name, sum(rows) as rows