Skip to content

Instantly share code, notes, and snippets.

Avatar

Pat Patterson metadaddy

View GitHub Profile
@metadaddy
metadaddy / Create-MarkerFiles.ps1
Last active Dec 1, 2022
PowerShell script to create a marker file in each empty directory under a given root directory
View Create-MarkerFiles.ps1
<# .SYNOPSIS
Create a marker file in each empty directory under a given root directory
.DESCRIPTION
This script recursively finds empty directories under the given root
directory and creates a marker file with the given filename in each one.
.NOTES
Author : Pat Patterson
#>
param (
@metadaddy
metadaddy / drivestats2parquet.py
Last active Nov 4, 2022
Python code for loading Drive Stats data into Backblaze B2 Cloud Storage
View drivestats2parquet.py
import copy
import os
import re
from datetime import date
from io import BytesIO
from zipfile import ZipFile
import pyarrow as pa
import pyarrow.csv as csv
@metadaddy
metadaddy / sync-deletes.py
Created Jul 19, 2022
Delete all files in a destination bucket that do not exist in a source bucket
View sync-deletes.py
import os
import sys
import boto3
from botocore.config import Config
from dotenv import load_dotenv
# Use -d command line option for a dry run - i.e. don't actually delete files
dry_run = len(sys.argv) == 2 and sys.argv[1] == '-d'
@metadaddy
metadaddy / b2_multipart.php
Last active Sep 6, 2022
PHP sample code for a multipart file upload to Backblaze B2. Usage: php php_multipart.php [-v] <bucket_name> <local_file>
View b2_multipart.php
<?php
// PHP sample code to show multipart file upload using the B2 Native API
// User supplies optional -v for verbose output from curl, then bucket name
// and path to local file
$rest_index = null;
$opts = getopt("v::", [], $rest_index);
$args = array_slice($argv, $rest_index);
@metadaddy
metadaddy / Purge All Deleted Objects.js
Last active Feb 25, 2022
UserScript to erase all the deleted custom objects from a Salesforce org with one click. In Classic UI, go to Setup | Create | Objects | Deleted Objects and the script should be available.
View Purge All Deleted Objects.js
// ==UserScript==
// @name Purge All Deleted Objects
// @description Erase all deleted custom objects from the Salesforce org
// @include https://*.salesforce.com/p/setup/custent/DeletedEntitiesList?*
// ==/UserScript==
// UserScripts: https://github.com/quoid/userscripts
// Sometimes, when you're testing Salesforce metadata operations, you end up with a
// lot of deleted custom objects in your org. There's no API to erase a deleted object,
@metadaddy
metadaddy / CitrixAuth.psm1
Last active Apr 14, 2021
Wrapper on Invoke-WebRequest to handle Citrix Cloud authentication, including token expiry
View CitrixAuth.psm1
<#
MIT License
Copyright 2021, Citrix Systems, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
@metadaddy
metadaddy / S3 to Azure Synapse.json
Last active Nov 7, 2019
Use StreamSets Cloud to read data from Amazon S3 and write to Azure Synapse (formerly SQL DW)
View S3 to Azure Synapse.json
{
"ciConfig" : null,
"currentExternalCIStatus" : null,
"currentRules" : {
"commitId" : "55b9a63d-8712-4a8d-96bf-511618889159:dpmfrancois",
"definitionRemoveMessage" : null,
"definitionRemoveTime" : 0,
"definitionRemover" : null,
"id" : "d53e9e53-eb4c-4204-9227-fd40d3a1b440:dpmfrancois",
"message" : "Committed with pipeline",
View personal_box.json
{
"pipelineConfig" : {
"schemaVersion" : 6,
"version" : 12,
"pipelineId" : "personalbox4f3590a2-1b4e-40ac-beae-600e976ef496",
"title" : "personal_box",
"description" : "",
"uuid" : "043a4e85-7989-4761-90de-e68401257e9e",
"configuration" : [ {
"name" : "executionMode",
View Metrics.json
{
"pipelineConfig" : {
"schemaVersion" : 6,
"version" : 12,
"pipelineId" : "Metrics635c20ed-872c-48d7-87fb-7043ab937ae6",
"title" : "Metrics",
"description" : "",
"uuid" : "08bce59b-151b-47d4-97dc-5d4f58da9672",
"configuration" : [ {
"name" : "executionMode",
@metadaddy
metadaddy / Validate JSON Data.json
Created May 9, 2019
StreamSets Data Collector 3.8.0 pipeline to Validate JSON against a schema
View Validate JSON Data.json
{
"pipelineConfig" : {
"schemaVersion" : 6,
"version" : 12,
"pipelineId" : "ValidateJSONDatab0dfa94e-faf3-42ec-9a02-5122d048fe4c",
"title" : "Validate JSON Data",
"description" : "",
"uuid" : "d504e9d3-d4ea-4d52-8fd8-565592400d2e",
"configuration" : [ {
"name" : "executionMode",