Skip to content

Instantly share code, notes, and snippets.

@na0x2c6
na0x2c6 / mic-toggle.applescript
Created May 12, 2021 08:10
Mic mute toggle script on Mac
-- refs: https://developer.apple.com/library/archive/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/ReadandWriteFiles.html
-- refs: https://medium.com/macoclock/how-in-the-bleep-do-i-mute-my-mic-anywhere-on-macos-d2fa1185b13
on writeTextToFile(theText, theFile, overwriteExistingContent)
try
set theFile to theFile as string
set theOpenedFile to open for access file theFile with write permission
if overwriteExistingContent is true then set eof of theOpenedFile to 0
write theText to theOpenedFile starting at eof
close access theOpenedFile
BNF = { }
-- create definition
BNF["::="] = function (stack)
local non_terminal = pop(stack) ;
push(BNF,non_terminal) ; end
-- add words to definition
BNF[";"] = function (stack)
local non_terminal = pop(BNF)
# MIT License
#
# Copyright (c) 2018 Jelle Hermsen
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@AetherDevSecOps
AetherDevSecOps / introspection.graphql
Last active April 29, 2021 03:38
GraphQL Get Entire Schema Using Introspection
__schema {
description
queryType {
kind
name
}
mutationType {
kind
name
}
@ggoodman
ggoodman / graphBuilder.ts
Created April 18, 2021 02:25
Exploration of building a module graph 'quickly' using esbuild and enhanced-resolve
import {
CachedInputFileSystem,
FileSystem,
ResolveContext,
ResolverFactory,
} from 'enhanced-resolve';
import { build, ImportKind, Loader } from 'esbuild';
import * as Fs from 'fs';
import Module from 'module';
import * as Path from 'path';
@mklement0
mklement0 / PSReadLineMetaInfoKeyHandler.ps1
Last active December 18, 2024 14:06
PowerShell sample code that demonstrates a PSReadLine key handler that display meta-information about the command being typed in real time.
<#
License: MIT
Author: Michael Klement <[email protected]>
See https://stackoverflow.com/a/67266971/45375 for more information.
#>
# The printable characters to respond to.
@masonlouchart
masonlouchart / utils.ts
Last active May 27, 2021 11:41
TypeScript groupBy
/**
* StackOverflow Question = https://stackoverflow.com/questions/14446511
* Based on StackOverflow Anser = https://stackoverflow.com/a/66987261/1832572
*/
/**
* Groups items on given criteria. The criteria can be a property or a function
* which is applied on each item.
*
* @param list The elements to be grouped ona criteria
@TheEpicFace007
TheEpicFace007 / npm-quality-of-life.js
Last active May 30, 2021 01:44
Add some quality of life improvement feature on npm
// ==UserScript==
// @name NPM Quality of life changes
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Add some quality of life improvenet to npm
// @author You
// @match http**://www.npmjs.com/**
// @grant none
// ==/UserScript==
function showNotif(notifText) {
@vibe
vibe / NodejsLambda.ts
Created April 2, 2021 11:13
Terraform CDK Lambda Typescript/NodeJS
import { Resource } from "cdktf";
import { Construct } from "constructs";
import { IamRole, LambdaFunction, LambdaLayerVersion, S3Bucket, S3BucketObject, SecurityGroup, Subnet, Vpc } from "@cdktf/provider-aws";
import { copySync, ensureDirSync, mkdtempSync, pathExistsSync, readJSONSync, removeSync, } from "fs-extra"
import { dirname, join, resolve } from "path";
import { buildSync } from 'esbuild'
import { spawnSync } from "child_process";
import { tmpdir } from "os";
import AdmZip from "adm-zip";
import { TemplateDirectory } from "@tf-cdk/template-directory";
@lcanady
lcanady / Graph.ts
Created March 29, 2021 22:23
A Simple Graph class, written with Typescript
export class Graph<T> {
private _adjList: Map<T, Set<T>>;
constructor() {
this._adjList = new Map<T, Set<T>>();
}
/**
* Add a Vert to the Graph
* @param v Vert to add