Skip to content

Instantly share code, notes, and snippets.

View cdeutsch's full-sized avatar
👨‍🏭
Hire me! Fullstack Engineer open to new developer or manager opportunities.

Christopher Deutsch cdeutsch

👨‍🏭
Hire me! Fullstack Engineer open to new developer or manager opportunities.
View GitHub Profile
@cdeutsch
cdeutsch / ingest-splitter.ts
Last active February 22, 2023 15:47
Axiom Ingest Splitter - Send logs to multiple datasets
/* eslint-disable import/no-default-export */
/**
* Axiom Ingest Splitter
*
* - Run `npx wrangler dev src/index.ts` in your terminal to start a development server
* - Open a browser tab at http://localhost:8787/ to see your worker in action
* - Run `npx wrangler publish src/index.ts --name my-worker` to publish your worker
*
* Learn more at https://developers.cloudflare.com/workers/
*
@cdeutsch
cdeutsch / pre-commit
Created November 14, 2022 23:30
Git pre-commit that checks for swearing
#######################################################################################################################################
# Check for swearing and other words
# https://gist.github.com/SkyM/1641459
#######################################################################################################################################
"`dirname $0`"/pre-commit-swearing
if [ $? -ne 0 ]
then
exit 1;
fi
@cdeutsch
cdeutsch / 1-user-store-server.ts
Last active September 26, 2019 19:15
Isomorphic Async Proposal
// UserStore.ts
//
// This is the code you write and is executed on the Node.js server side.
// The decorators can be used to automatically turn it into Express routes.
//
// Pretty much already exists using `routing-controllers` NPM
@Route('/api/users')
export class UserStore {
@Get('/')
@cdeutsch
cdeutsch / gist:c4956470468cb65aefa7a84b0d0c214d
Created July 18, 2019 16:18
~/Library/KeyBindings/DefaultKeyBinding.dict
{
"$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
"$\UF72B" = moveToEndOfParagraphAndModifySelection:; // shift-end
"^\UF729" = moveToBeginningOfDocument:; // ctrl-home
"^\UF72B" = moveToEndOfDocument:; // ctrl-end
"^$\UF729" = moveToBeginningOfDocumentAndModifySelection:; // ctrl-shift-home
"^$\UF72B" = moveToEndOfDocumentAndModifySelection:; // ctrl-shift-end
/* home */
"\UF729" = "moveToBeginningOfLine:";
@cdeutsch
cdeutsch / index.js
Created May 11, 2018 19:51
Amazon AWS IOT Button to Webhook POST
const https = require('https');
const querystring = require('querystring');
exports.handler = (event, context, callback) => {
console.log('Received event:', event);
const postData = querystring.stringify({});
const options = {
hostname: 'my-glitch.glitch.me',
@cdeutsch
cdeutsch / index.js
Created May 11, 2018 19:37
Amazon AWS IOT Button to IFTTT Webhook
/**
* This is a sample that connects Lambda with IFTTT Maker channel. The event is
* sent in this format: <serialNumber>-<clickType>.
*
* The following JSON template shows what is sent as the payload:
{
"serialNumber": "GXXXXXXXXXXXXXXXXX",
"batteryVoltage": "xxmV",
"clickType": "SINGLE" | "DOUBLE" | "LONG"
}
@cdeutsch
cdeutsch / .gitconfig
Last active May 1, 2018 21:09
My Git aliases
[alias]
# short hand
co = checkout
br = branch
# short hand with some flags
st = status -sb
# reset all files
nuke = reset --hard HEAD
@cdeutsch
cdeutsch / webpack.config.js
Last active March 26, 2019 12:57
Caching Webpack v4 css-loader CSS Modules with LESS
module: {
rules: [
{
test: /\.less$/,
use: [
...(process.env.NODE_ENV === 'production'
? [
{
loader: MiniCssExtractPlugin.loader,
},
@cdeutsch
cdeutsch / toggle.scpt
Created April 12, 2018 20:18
Toggle Play Pause in Google Chrome using AppleScript
if application "Google Chrome" is running then
tell application "Google Chrome"
activate
repeat with w in (windows)
set j to 0
repeat with t in (tabs of w)
set j to j + 1
tell t
if URL starts with "http://www.youtube.com/watch" or URL starts with "https://www.youtube.com/watch" then
set (active tab index of w) to j
@cdeutsch
cdeutsch / gist:e1700dc128364e589e7781516f0ed4d1
Created April 10, 2018 16:15
Select words in JSON and CSS using `cmd+D` in VSCode the way God intended
// This will comment out any lines that begin with wordPattern in jsonMain.js and cssMain.js
// jsonMain.js and cssMain.js moved to these locations in VSCode 1.22.1
sed -i -e "s/wordPattern/\/\/wordPattern/g" /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/extensions/json-language-features/client/out/jsonMain.js
sed -i -e "s/wordPattern/\/\/wordPattern/g" /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/extensions/css-language-features/client/out/cssMain.js