View wakeup.rb
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
use_bpm 60 | |
use_synth :kalimba | |
define :calm_section do | |
play_pattern_timed [:c4, :e4, :g4, :c5], [0.5, 0.5, 0.5, 1] | |
play_pattern_timed [:c4, :e4, :g4, :b4], [0.5, 0.5, 0.5, 1] | |
play_pattern_timed [:c4, :d4, :g4, :a4], [0.5, 0.5, 0.5, 1] | |
play_pattern_timed [:c4, :d4, :g4, :g4], [0.5, 0.5, 0.5, 1] | |
end |
View Set-NumLockOn.ps1
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
Add-Type -TypeDefinition @" | |
using System; | |
using System.Runtime.InteropServices; | |
public static class NumLock { | |
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true, CallingConvention = CallingConvention.Winapi)] | |
public static extern short GetKeyState(int keyCode); | |
[DllImport("user32.dll", EntryPoint = "keybd_event", CharSet = CharSet.Auto, ExactSpelling = true, CallingConvention = CallingConvention.Winapi)] | |
public static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo); |
View Write-ThisDown.ps1
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
function Write-ThisDownHere { | |
[CmdletBinding()] | |
param ( | |
[Parameter(ValueFromPipeline = $true)] | |
$InputObject, | |
[ValidateSet("Host", "Info", "Log")] | |
$Medium = "Host", | |
[ValidateSet("List", "Table", "Wide", "String", "JSON", "Raw")] |
View googleworkspace_resource_custodian.gs
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
// | |
const NOOP = true; // must be === false to make *ANY* actual modification work happen, not just !== true. | |
// | |
const GROUP_CREATION_OKAY = false; // must be === true for this to happen | |
const ACLRULE_ADD_OKAY = false; // must be === true for this to happen | |
const ACLRULE_REMOVE_OKAY = false; // must be === true for this to happen | |
const ACLRULE_FIXROLE_OKAY = false; // must be === true for this to happen | |
// | |
const GROUP_TEMPLATE = { | |
name: ({buildingName}) => buildingName + " Resource Custodian Role", |
View resolveRelationships.js
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
function resolveRelationships(relationships, included, parentIds) { | |
if (typeof relationships !== "object" || !Object.keys(relationships).length) return []; | |
if (typeof included !== "object" || !Array.isArray(included)) return []; | |
if (typeof parentIds === "string") parentIds = [parentIds]; | |
if (typeof parentIds !== "object" || !Array.isArray(parentIds)) parentIds = []; | |
/** | |
* @param {string} type | |
* @returns {string} | |
*/ |
View Code.gs
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
// An example of how something like this could be used: | |
// | |
// Set some ranges as NamedRanges named "ColumnFormat_PhoneNumber" and "ColumnFormat_DateTime" | |
// and those will end up processed by the functions named "Format_PhoneNumber" and "Format_DateTime" | |
// which should enforce a value format or number format or possibly even a visual format upon edit | |
// and then set occasionalSheetFormatPatrol as a scheduled trigger to catch the items that were | |
// updated by API/scripts or other things that couldn't have been caught by the onEdit function. | |
// ** | |
function occasionalSheetFormatPatrol() { |
View DoRangesHaveOverlap.gs
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
/** | |
* @param {SpreadsheetApp.Range} ranges | |
* @returns {boolean} | |
* - `true` indicates all ranges share the same overlapping point(s) with all others | |
* - `false` indicates no shared overlap point, even if they all overlap individually | |
*/ | |
function DoRangesHaveOverlap(...ranges) { | |
return GetRangeUnion(...ranges) !== null; | |
} |
View QueryString.gs
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
/** | |
* @param {string} url | |
* @param {Object<string,string|string[]>} qs - query string | |
*/ | |
function urlWithQueryStringObject(url, qs) { | |
if (!qs) return url; | |
return [ | |
url, | |
Object.entries(qs) | |
.map(([k,v]) => { |
View Install-WinGetCli.ps1
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
function Get-FilesFromGithubLatestRelease { | |
# original function from https://github.com/microsoft/winget-cli/issues/1861#issuecomment-1193136622 | |
param ( | |
[parameter(Mandatory)][string]$Project, # e.g. paintdotnet/release | |
[parameter(Mandatory)][string[]]$Patterns, # regex | |
[switch]$Prerelease | |
) | |
$releases = Invoke-RestMethod -Method Get -Uri "https://api.github.com/repos/$Project/releases" | |
$release = $releases | Where-Object { $_.prerelease -eq $Prerelease } | Select-Object -First 1 |
View DATEMAX(range)
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
= | |
ARRAY_CONSTRAIN( | |
SORT( | |
FILTER( | |
range, | |
MAP( | |
range, | |
LAMBDA( | |
cell, | |
ISDATE(cell) |
NewerOlder