Skip to content

Instantly share code, notes, and snippets.

View kenotron's full-sized avatar
🐽

Kenneth Chau kenotron

🐽
  • Microsoft
View GitHub Profile
@kenotron
kenotron / download_comfyui_assets.py
Created May 12, 2025 16:51
Download IPAdapter for a fun side project of producing profession looking headshot photo of myself using ComfyUI
'''
This script downloads ComfyUI assets, including the IPAdapter_plus custom node and various models.
It assumes you are running on Windows and places the files in a "comfyui" folder
within your user's Documents directory.
'''
import os
import subprocess
import requests
from tqdm import tqdm # For progress bar, ensure it's installed: pip install tqdm
@kenotron
kenotron / duplex.sh
Last active March 9, 2025 07:52
ghostscript to deal with 3 hole punch margins
#!/bin/sh
gs \
-o output_duplex_ch6.pdf \
-dFirstPage=643 \
-dLastPage=726 \
-sDEVICE=pdfwrite \
-dBATCH \
-dNOPAUSE \
-dDEVICEWIDTHPOINTS=612 \
-dDEVICEHEIGHTPOINTS=792 \
@kenotron
kenotron / playwright.config.js
Last active October 18, 2023 03:17
Playwright Github Workflow
import { defineConfig, devices } from "@playwright/test";
import { generateTestDatabaseUrl } from "~/db/generate-test-url";
import 'dotenv/config';
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();
ActionButton: (...)
ActivityItem: (...)
AnimationClassNames: (...)
AnimationStyles: (...)
AnimationVariables: (...)
Announced: (...)
AnnouncedBase: (...)
Async: (...)
AutoScroll: (...)
Autofill: (...)
@kenotron
kenotron / bootstrap.sh
Created August 10, 2020 21:28
New VM with node.js
#!/bin/bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
nvm install --lts
npm install -g yarn
@kenotron
kenotron / tsconfig.json
Last active May 20, 2020 19:25
tsconfig.json
{
"compilerOptions": {
"target": "es2017",
"lib": ["es2017"],
"rootDir": "src",
"outDir": "lib",
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
"allowJs": true,
#!/bin/sh
browser_download_url=`curl -s https://api.github.com/repos/Microsoft/azure-pipelines-agent/releases/latest | jq -r ".assets[].browser_download_url"`
download_url=`curl -s -L ${browser_download_url} | jq -r ".[] | select(.platform==\"linux-x64\") | .downloadUrl"`
echo Downloading from $download_url
sudo -E -u agent curl -s -L $download_url --output /home/agent/agent.tar.gz
echo Fixing perms
sudo -E -u root mkdir -p /agent
@kenotron
kenotron / create-react-app-uifabric
Last active April 30, 2019 18:29
Patch create-react-app to use UI Fabric
git clone https://github.com/kenotron/create-react-app-uifabric.git
cd create-react-app-uifabric
yarn
yarn start
diff --git a/package.json b/package.json
index af283fb..abbbd11 100644
--- a/package.json
+++ b/package.json
@@ -7,6 +7,8 @@
"@types/node": "11.13.8",
"@types/react": "16.8.15",
"@types/react-dom": "16.8.4",
+ "office-ui-fabric-react": "^6.174.0",
+ "@uifabric/fluent-theme": "^0.16.7",
@kenotron
kenotron / set-gc.js
Created October 1, 2017 23:51
Sets causing tons of GC
const map = new Map();
const set = new Set();
const MAX_KEYS = 10 * 1024 * 1024;
const SET_KEYS = 10 * 1024 * 1024;
console.log("Call map.set() a LOT");
for (let i = 0; i < MAX_KEYS; i++) {
map.set(i, i);
}