Skip to content

Instantly share code, notes, and snippets.

View lantrix's full-sized avatar
:octocat:
always coding and merging

Ted B lantrix

:octocat:
always coding and merging
View GitHub Profile
Connecting to host 10.0.0.100, port 5201
[ 5] local 10.0.0.11 port 55740 connected to 10.0.0.100 port 5201
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 3.63 MBytes 30.4 Mbits/sec
[ 5] 1.00-2.00 sec 39.6 KBytes 323 Kbits/sec
[ 5] 2.00-3.00 sec 933 KBytes 7.67 Mbits/sec
[ 5] 3.00-4.00 sec 2.33 MBytes 19.6 Mbits/sec
[ 5] 4.00-5.00 sec 256 KBytes 2.10 Mbits/sec
[ 5] 5.00-6.00 sec 3.46 MBytes 29.0 Mbits/sec
[ 5] 6.00-7.00 sec 1.19 MBytes 9.91 Mbits/sec
@lantrix
lantrix / picard-package.sh
Last active December 27, 2020 08:08
Package https://github.com/metabrainz/picard locally based off their Mac Github Actions.
#!/usr/bin/env bash
set -e
# Build Picard package - copied from github actions
# https://raw.githubusercontent.com/metabrainz/picard/4138db54301a0d5e0727c758f78b4306ae1e57bb/.github/workflows/package.yml
export DISCID_VERSION='0.6.2'
export FPCALC_VERSION='1.5.0'
export PYTHON_VERSION='3.7.6'
export PYTHON_MAJOR_VERSION='3.7'
@lantrix
lantrix / export-exif-to-csv.sh
Last active April 6, 2021 12:25
Exiftool export to CSV
#!/bin/bash
outputFile='/tmp/_scanned_photo_index_raw.csv'
# Header
echo "Outputting to: ${outputFile}"
echo "Photo ID,Filename,Date,Create (Scan) Date,Type,Resolution DPI,ImageSize,Megapixels,GPSLatitude,GPSLongitude,GPSPosition,ImageWidth,ImageHeight,FileSize,Album,Box,Custodian,Location,Metadata updated,Notes" > ${outputFile}
# Data
for photo in `ls -art |grep tif |grep -v reverse`; do
echo "Parsing $photo"
human=$(exiftool -f -d "%Y/%m/%d" -p '$Filename;$DateTimeOriginal;$CreateDate;$FileType;$XResolution;$ImageSize;$Megapixels;$GPSLatitude;$GPSLongitude;$GPSPosition;$ImageWidth;$ImageHeight;$FileSize;$ImageDescription' $photo)
numeric=$(exiftool -n -f -d "%Y/%m/%d" -p '$Filename;$DateTimeOriginal;$CreateDate;$FileType;$XResolution;$ImageSize;$Megapixels;$GPSLatitude;$GPSLongitude;$GPSPosition;$ImageWidth;$ImageHeight;$FileSize;$ImageDescription' $photo)
Set-AWSCredential -ProfileName myprofile
Set-DefaultAWSRegion -Region ap-east-1
$images = Get-EC2Image -Owner self -Verbose
# Our parallel processing code is now inside a function that takes start end end array indexes as parameters
function ProcessFiles([int]$FromIndex, [int]$ToIndex) {
$images[$FromIndex..$ToIndex] | Where-Object {$_.CreationDate -Like "2020-04*"} | ForEach-Object -ThrottleLimit 6 -Parallel {
Write-Output -InputObject "Image $($_.ImageId) $($_.CreationDate) $($_.Name)"
Unregister-EC2Image -ImageId $($_.ImageId) -Verbose
# Buildtime
DOCKER_BUILDKIT=1 docker build \
-f Dockerfile \
-t myimage \
--secret id=aws,src=$HOME/.aws/credentials \
.
# Runtime
docker run -it \
--rm \
@lantrix
lantrix / experimental.md
Created April 15, 2020 05:16
Docker Buildkit Experimental

Dockerfile frontend experimental syntaxes

Note for Docker users

If you are using Docker v18.06 or later, BuildKit mode can be enabled by setting export DOCKER_BUILDKIT=1 on the client side. Docker v18.06 also requires the daemon to be running in experimental mode.

You need to use docker build CLI instead of buildctl CLI mentioned in this document. See the docker build document for the usage.

# Name of our service
service: daily-instance-snapshot
# The required version of serverless we have to be using for this to work
frameworkVersion: ">=1.26.0 <2.0.0"
##############################
# Our service provider and runtime/region definitions
##############################
provider:
@lantrix
lantrix / pipeline.yml
Created February 17, 2020 07:57
Buildkite pipeline example for Lambda PowerShell Build environment to deploy PowerShell .NET CORE 2.1 Lambda on AWS
env:
VERSION: 0.1.${BUILDKITE_BUILD_NUMBER}
steps:
- label: ":docker: Build Powershell Lambda Environment"
command: 'echo Building PS Docker Image...'
agents:
queue: myQueue
plugins:
@lantrix
lantrix / lambda-schedule-rule-template.yaml
Created November 26, 2019 12:50
Example of invoking a lambda by ARN and providing fixed input JSON to the lambda as the event - for AWS CloudFormation in YAML
AWSTemplateFormatVersion: "2010-09-09"
Description: A Schedule to invoke a Lambda
Parameters:
LambdaArn:
Type: String
Description: ARN of the lambda to be invoked
Resources:
InvokeLambdaRole:
Type: AWS::IAM::Role
Properties:
$lambda = 'test-ps-lambda'
Install-Module -Name AWS.Tools.Installer, AWSLambdaPSCore
Install-AWSToolsModule -Name Common, CloudWatchLogs, Lambda -Cleanup
New-AWSPowerShellLambda -Template Basic -ScriptName TestLambda -Directory testlambda
# Publish Lambda
$publishParams = @{
ScriptPath = ".\TestLambda.ps1"