This file contains hidden or 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
/* Example program to collate certificate information with application information */ | |
pgm | |
dcl &sys *char 8 | |
dcl &ccsid *dec (5 0) | |
dcl &sql *char 5000 | |
/* Because reasons... */ | |
rtvjoba ccsid(&ccsid) | |
chgjob ccsid(37) |
This file contains hidden or 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 | |
# | |
# ARG_OPTIONAL_SINGLE([switch],[],[Switch 'on' or 'off']) | |
# ARG_OPTIONAL_SINGLE([rgb],[],[RGB triplet (0-255)]) | |
# ARG_OPTIONAL_SINGLE([temp],[],[Colour temperature (2000-6500)K]) | |
# ARG_OPTIONAL_SINGLE([dim],[],[Dimming level (1-100)]) | |
# ARG_POSITIONAL_INF([lights],[Lights to set],[1]) | |
# ARG_HELP([Allows control of Philips Hue lights via Hue Bridge]) | |
# ARGBASH_GO() | |
# needed because of Argbash --> m4_ignore([ |
This file contains hidden or 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/zsh | |
tmp=$(ioreg -c 'AppleDeviceManagementHIDEventService' | grep 'BatteryPercent\|\"Magic' | sed -e 's/[ |]*//' -e 's/\"//g' -e 's/\Product = //' -e 's/BatteryPercent //' | paste -d\ - - | sed 's/Magic \(.\).* = /\1/') | |
arr=(${(f)tmp}) | |
count=1 | |
for d in "${arr[@]}"; do | |
# Extract type and percentage | |
type="${d[1,1]}" | |
pct="${d[2,3]}" | |
# Define base symbol based on type |
This file contains hidden or 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/zsh | |
# Get a count of the number of external disks | |
count=$(df -Hl | grep '^/dev.*\s/Volumes' | wc -l | tr -d '[:space:]') | |
# Assuming less than 10, turn the number into an SF symbol, e.g. "5.square" | |
strip=$(echo -n "$count.square") | |
# Generate a list of the volume names to include in the menu for info | |
vols=$(df -Hl | grep '^/dev.*\s/Volumes' | sed -e 's|^/dev/.*/Volumes/||' | sort) | |
# Output | |
echo ":$strip: | sfcolor=#ffffff sfsize=18\n---\n$vols" |
This file contains hidden or 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
-- DB2 has a MERGE statement which is designed to merge the rows from one table into another. | |
-- This technique adapts that to the case of a single row of literal values (such as might be provided in an application program). | |
-- This is informally known as an 'upsert' - a portmanteau of "update" and "insert". | |
-- The key parts of this statement are: | |
-- 1. The USING clause provides the values for the entire row, and also provides column names for these. | |
-- 2. The ON clause is the means for detecting an existing record (like a join's ON clause). | |
-- 3. The WHEN MATCHED clause specifies which columns to update in an existing record. Obviously this won't contain the keys, but needn't contain all the other columns either. | |
-- 4. The INSERT VALUES clause uses the column names provided in the USING clause. |
This file contains hidden or 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/zsh | |
# REQUIRES: ImageMagick | |
# Splits out the individual images using the original filename plus a suffix | |
convert multi-page.tiff -set filename:f "%[t]_%[fx:t+1]" +adjoin "%[filename:f].tif" |
This file contains hidden or 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/zsh | |
# REQUIRES: ExifTool | |
# Finds Pentax "Pixel Shift" RAW files in the current directory (and below) and adds an XMP label. | |
# This enables them to be spotted in RAW processing software that can't handle them. | |
# The -r flag recurses down through directories, and the . starts at the current directory. Change as desired. | |
# Change the label 'Purple' as desired. | |
exiftool -if 'Pentax:$quality =~ /shift/i' -XMP-xmp:Label=Purple -r . |
This file contains hidden or 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/zsh | |
# Ejects "ejectable" drives. Use list_drives.sh to validate this will correctly identify and eject the drives you have. | |
df | egrep df | egrep '^(/dev/disk|exfat).+\s/Volumes' | sed -E 's|.+/(.+)|\1|' | sort | tr '\n' ' ' | sed -E 's|(.+) |💿 \1\n|' | sed -E 's|.+/(.+)|\1|' | xargs -n 1 diskutil eject |