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 / _ 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 / 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 / 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 / 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 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 / 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 / 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"
}
@font-face {
font-family: SegoeUI;
src:
local("Segoe UI Light"),
url(//c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff2) format("woff2"),
url(//c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff) format("woff"),
url(//c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.ttf) format("truetype");
font-weight: 100;
}
DISM.exe /Online /add-capability /CapabilityName:Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0
DISM.exe /Online /add-capability /CapabilityName:Rsat.BitLocker.Recovery.Tools~~~~0.0.1.0
DISM.exe /Online /add-capability /CapabilityName:Rsat.GroupPolicy.Management.Tools~~~~0.0.1.0
DISM.exe /Online /add-capability /CapabilityName:Rsat.ServerManager.Tools~~~~0.0.1.0
@emmaly
emmaly / boxarray.js
Created September 15, 2020 00:54
BOXARRAY
function isEmpty_(value) {
if (value == undefined) return true;
if (value == null) return true;
if (typeof value == "string" && value == "") return true;
if (typeof value == "number") return false;
return false;
}
/**
* Expands the array to match lengths, and forces them into arrays.