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 logging | |
import time | |
from contextlib import AbstractContextManager | |
from logging import Handler, LogRecord | |
from typing import Any, List, Optional | |
from pyspark.sql import SparkSession | |
logging.basicConfig(level=logging.INFO) |
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
<?php | |
/** | |
* Normalise a file path string so that it can be checked safely. | |
* | |
* Attempt to avoid invalid encoding bugs by transcoding the path. Then | |
* remove any unnecessary path components including '.', '..' and ''. | |
* | |
* @param $path string | |
* The path to normalise. | |
* @param $encoding string |
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 python3 | |
# | |
# I do this infrequently enough I always forget how this stuff works and have to read the code to figure it out. | |
# | |
import logging | |
import sys | |
formatter = logging.Formatter( | |
fmt='%(asctime)s - %(levelname)s - %(message)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
/** | |
* Read the value of a header in the current document. | |
* | |
* This uses a [single] XMLHTTPRequest to do a HEAD of the current document | |
* and fetch HTTP response header values. Note that the implementation is | |
* rather stupid in that it spins waiting for the XMLHTTPRequest to complete | |
* if it hasn't been called yet. | |
* | |
* @param name string |
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 | |
# vault-get-keytab | |
# | |
# Rather than verify that it’s exactly the keytab we expect, this script checks that it is | |
# (or appears to be) a keytab for the required principal. | |
set -eu | |
$vault_path=“$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 | |
# | |
# This script will hold your hand during the process of converting an existing Drupal 7 file field from public to private. | |
# | |
# http://twitter.com/thsutton | |
# http://www.linkedin.com/pub/thomas-sutton/55/391/350 | |
# http://thomas-sutton.id.au/ | |
set -eu |
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/bash | |
fmt="$1" | |
n=0 | |
while [[ n -lt 5 ]]; do | |
n=$((n + 1)) | |
date "+o: $fmt" | |
echo -n "antici" |
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 stack | |
-- stack --resolver lts-12.4 --install-ghc runghc --package QuickCheck | |
-- | |
-- If you have Haskell Stack installed (brew install haskell-stack) you | |
-- can execute this script directly: | |
-- | |
-- $ chmod +x trianglenumbers.hs | |
-- $ ./trianglenumbers.hs | |
{-# LANGUAGE TemplateHaskell #-} |
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
$ mkdir example | |
$ cd example | |
$ cat > main.tf <<EOF | |
provider "aws" { region = "ap-southeast-2" } | |
resource "aws_s3_bucket" "state" { | |
bucket = "thomas-example-s3-stateception" | |
acl = "private" | |
} |
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
[me@home test]$ ls -lash | |
total 4360 | |
0 drwxr-xr-x 9 me staff 288B 18 Dec 11:46 ./ | |
0 drwxr-xr-x 18 me staff 576B 13 Dec 17:12 ../ | |
0 drwxr-xr-x 3 me staff 96B 8 Dec 13:05 .terraform/ | |
4224 -rw-r--r-- 1 me staff 1.5M 18 Dec 10:27 crash.log | |
8 -rw-r--r-- 1 me staff 1.4K 13 Dec 10:17 example.txt | |
0 lrwxr-xr-x 1 me staff 48B 8 Dec 13:05 terraform-provider-azurerm@ -> /Users/me/go/bin/terraform-provider-azurerm | |
56 -rw-r--r-- 1 me staff 24K 18 Dec 11:46 terraform.tfstate | |
56 -rw-r--r-- 1 me staff 24K 18 Dec 11:46 terraform.tfstate.backup |
NewerOlder