Skip to content

Instantly share code, notes, and snippets.

View emmaly's full-sized avatar
🔄
Synchronizing everything, everywhere, all at once.

Emmaly emmaly

🔄
Synchronizing everything, everywhere, all at once.
View GitHub Profile
@emmaly
emmaly / chat.ahk
Last active October 19, 2021 21:44
Google Chat launcher via AutoHotkey
; Chat.ahk v1.1 2021-10-17 emmaly
SetTitleMatchMode, RegEx
if WinExist("^(.* +- +)?Chat$ ahk_exe chrome.exe")
{
WinActivate
} else {
Run, "C:\Program Files\Google\Chrome\Application\chrome_proxy.exe" --profile-directory="Profile 1" --app-id=mdpkiolbdkhdjpekfbkbmhigcaggjagi, "C:\Program Files\Google\Chrome\Application"
}
@emmaly
emmaly / meet.ahk
Last active November 20, 2021 09:12
Google Meet launcher via AutoHotkey
; Meet.ahk v1.2 2021-11-20 emmaly
SetTitleMatchMode, RegEx
if WinExist("^(Google Meet|(Google Meet - )?Meet - [a-z]{3}-[a-z]{4}-[a-z]{3})$ ahk_exe chrome.exe")
{
WinActivate
} else {
Run, "C:\Program Files\Google\Chrome\Application\chrome_proxy.exe" --profile-directory="Profile 1" --app-id=kjgfgldnnfoeklkmfkjfagphfepbbdan, "C:\Program Files\Google\Chrome\Application"
}
@emmaly
emmaly / code.gs
Created October 21, 2021 03:46
Google Sheet Style Janitor
const DEBUG = false;
function onEdit(e) {
ScriptProperties.setProperties({
"dirty": "true",
"lastHumanEdit": (new Date()).toJSON(),
});
}
function janitor() {
@emmaly
emmaly / setter.js
Created November 6, 2021 12:13
Colon-delimited tree setting thingy in JavaScript
let data = {};
const setter = (o, p, v) => {
if (typeof p === "string") {
return setter(o, p.split(/\s*:\s*/), v);
}
if (p.length === 1) {
o[p[0]] = v;
return o;
}
@emmaly
emmaly / code.gs
Created November 22, 2021 23:04
Google Sheets onEdit range row walker
function onEdit(e) {
const range = e.range;
const sheet = range.getSheet();
if (sheet.getSheetId() == 123123123) { // whatever sheet ID
for (let i=0; i<range.getNumRows(); i++)
rowOnEdit(sheet.getRange(range.getRow()+i, 1, 1, sheet.getLastColumn()));
}
}
function rowOnEdit(rowRange) {
@emmaly
emmaly / exampleArrayProcessor.js
Last active May 13, 2022 09:18
A way to process an array via map and filter by passing an array of maps and filters
function buildArrayProcessorChain (rawArrayProcessors) {
const arrayProcessors = (typeof rawArrayProcessors !== "object" ? [] :
Array.isArray(rawArrayProcessors) ? rawArrayProcessors : [rawArrayProcessors])
.filter(v => (v.map === undefined && typeof v.filter === "function") || (v.filter === undefined && typeof v.map === "function"));
if (arrayProcessors.length === 0) return (a) => a; // nothing to do
return arrayProcessors.reduceRight((p, c) => {
// filter
if (typeof c.filter === "function") return (a) => typeof p !== "function" ? Array.prototype.filter.call(a, c.filter) : p(Array.prototype.filter.call(a, c.filter));
@emmaly
emmaly / _ Google Workspace Group Query Utils.md
Last active May 13, 2022 10:11
Google Workspace Group Query Utils

Google Workspace Group Query Utils

This will require Google Workspace Admin SDK API admin/AdminDirectory/directory_v1 service enabled. See appsscript.json.

@emmaly
emmaly / NextDNS-DNS-over-DOH.ps1
Last active August 3, 2022 20:26
DNS-over-HTTP (DoH) NextDNS automatic configuration via PowerShell for Windows 11 (and maybe Windows 10?)
<# NextDNS install as DNS-over-DOH #>
param (
[Parameter(
Mandatory = $true,
ParameterSetName = "NextDnsId",
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true,
HelpMessage = "NextDNS Configuration ID, like: 12ab3c"
)]
@emmaly
emmaly / jsDoc-AppsScript.gs
Created July 27, 2022 02:20
JSDoc for Google Apps Script doGet/doPost
// JSDoc for Google Apps Script doGet/doPost
/**
* @param {object} e
* @param {string|null} e.queryString - The value of the query string portion of the URL, or `null` if no query string is specified
* @param {Object.<string,string>} e.parameter - An object of key/value pairs that correspond to the request parameters. Only the first value is returned for parameters that have multiple values.
* @param {Object.<string,string[]>} e.parameters - An object similar to `e.parameter`, but with an array of values for each key
* @param {number} e.contentLength - The length of the request body for POST requests, or -1 for GET requests
* @param {object} e.postData - An object constructed from the POST body of POST requests, or `null` for GET requests
* @param {number} e.postData.length - The same as `e.contentLength`
@emmaly
emmaly / ProjectSharedDrive.gs
Created September 13, 2022 05:42
Google Sheet Protection Maintenance
const PROJECT_DRIVE_ID = ".......................";
/**
* @returns {string[]} Project Managers
*/
function getProjectManagers() {
return getSharedDriveManagers(PROJECT_DRIVE_ID);
}