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 sys | |
import os | |
import gspread | |
from google.oauth2 import service_account | |
def get_gspread_client() -> gspread.Client: | |
scope = ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/spreadsheets"] | |
# see https://docs.gspread.org/en/latest/oauth2.html | |
credentials_path = os.environ.get('GOOGLE_SERVICE_ACCOUNT_CREDENTIALS', None) |
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 airflow | |
import getpass | |
import logging | |
from airflow import models, settings | |
from airflow.contrib.auth.backends.password_auth import PasswordUser | |
def set_password(name, password): | |
session = settings.Session() | |
u = session.query(PasswordUser).filter_by(username=name).first() |
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 golang:1.15 AS build | |
WORKDIR /build | |
RUN go mod init example.com/sops-build \ | |
&& go get -u go.mozilla.org/sops/v3/cmd/sops@develop | |
RUN go get -u filippo.io/age/cmd/... | |
FROM scratch AS bin | |
COPY --from=build /go/bin/sops / |
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
SELECT | |
tmp.ipAddress, | |
-- Calculate how many connections are being held by this IP address. | |
COUNT( * ) AS ipAddressCount, | |
-- For each connection, the TIME column represent how many SECONDS it has been in | |
-- its current state. Running some aggregates will give us a fuzzy picture of what | |
-- the connections from this IP address is doing. | |
FLOOR( AVG( tmp.time ) ) AS timeAVG, |
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
SET @COLS = ''; | |
SELECT GROUP_CONCAT( COLUMN_NAME SEPARATOR ',') | |
INTO @COLS | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE COLUMN_KEY != 'PRI' | |
AND TABLE_NAME='mytable' | |
AND TABLE_SCHEMA = 'mydatabase'; | |
SET @SQL = CONCAT('SELECT ', @COLS, ' FROM mytable'); | |
PREPARE stmt FROM @SQL; | |
EXECUTE stmt; |
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/env bash | |
# Inspired by: https://github.com/kayrus/kuttle | |
# Usage: | |
# | |
# sshuttle -v -r 'none' -e /path/to/this_script 172.20.0.0/16 | |
# | |
set -e | |
VERSION=0.1 |
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 io | |
import boto3 | |
import datetime | |
from zipfile import ZipFile | |
from dateutil.tz import tzutc | |
from botocore.config import Config | |
outfile = sys.argv[1] |
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
#!/bin/sh | |
HOST_PORT=30022 | |
DRYRUN= | |
if [ "$1" = "-n" ] ; then | |
DRYRUN=true | |
shift | |
fi | |
TARGET=$1 |
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
--- | |
kind: DaemonSet | |
apiVersion: extensions/v1beta1 | |
metadata: | |
name: whoami-daemonset | |
labels: | |
k8s-app: whoami | |
spec: | |
template: | |
metadata: |
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
#!/bin/sh | |
NAME=$(basename $0) | |
PROFILE=${NAME#tf} | |
export TERRAGRUNT_DOWNLOAD=.terragrunt-cache-$PROFILE | |
exec env -u TF_DATA_DIR aws-vault exec $PROFILE -- "$@" |
NewerOlder