Skip to content

Instantly share code, notes, and snippets.

View joshkautz's full-sized avatar
🧠
Always Learning

Josh Kautz joshkautz

🧠
Always Learning
View GitHub Profile
@joshkautz
joshkautz / index.js
Last active November 16, 2023 16:22
Puppeteer to automate filling out a form and submit. Now handles when form elements are in an iframe.
import puppeteer from "puppeteer";
let browser = null;
let selector = null;
let frame = null;
(async () => {
try {
browser = await puppeteer.launch({ headless: false });
@joshkautz
joshkautz / configure.ps1
Last active March 28, 2023 04:15
Windows 11 | Dev Env Config
# Run in PowerShell
# Configure Terminal App
# TODO: Download images from hosting
# Download & Install Pyenv
Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1" -OutFile "./install-pyenv-win.ps1"; &"./install-pyenv-win.ps1"
# Download & Install AWS CLI
@joshkautz
joshkautz / maskify.js
Created March 28, 2022 19:08
Credit Card detection regex
// Detect strings with potential credit cards in them and mask the credit cards.
// Credit card strings are strings that have 13-16 consecutive digits.
const maskify = (input) => {
const regex = /\b\d{13,16}\b/;
var card = input.match(regex);
return (card) ? mask(input, card[0]) : input;
}
const mask = (input, card) => {
@joshkautz
joshkautz / main.dart
Created July 19, 2021 18:18
Flutter - Display SnackBar on top of AlertDialog widget
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
@joshkautz
joshkautz / main.dart
Last active June 14, 2021 16:50
Shortest path between two cells in a matrix
import 'dart:collection';
class Point {
int x;
int y;
Point({required this.y,required this.x});
}
void main() {
print('Finding a viable solution for the shortest path...');
@joshkautz
joshkautz / Replace TextEdit as the default macOS text editor.md
Last active April 23, 2024 19:58
Replace TextEdit as the default text editor

Replace TextEdit as the default text editor application for opening plain text files and files with no extensions on macOS.

Run the following command in the Terminal to find the bundle identifier for your desired text editor application:

$ osascript -e 'id of app "Visual Studio Code"'
com.microsoft.VSCode

$ osascript -e 'id of app "Sublime Text"'
com.sublimetext.3
@joshkautz
joshkautz / $macOS Big Sur 11.1: System Preferences → Sharing.md
Last active December 27, 2020 22:26
macOS Big Sur 11.1: System Preferences → Sharing.md

System Preferences → Sharing:

  • Navigate to  → About This Mac → Overview
  • Copy Serial Number
  • Replace Computer Name with Serial Number
@joshkautz
joshkautz / $macOS Big Sur 11.1: System Preferences → Trackpad.md
Last active December 27, 2020 22:14
macOS Big Sur 11.1: System Preferences → Trackpad.md

System Preferences → Trackpad → Point & Click:

  • Look up & data detectors: Enabled: Force Click with one finger
  • Secondary click: Enabled: Click with two fingers
  • Tap to click: Disabled
  • Click: Medium
  • Tracking speedy: 4
  • Force Click and haptic feedback: Enabled

System Preferences → Trackpad → Scroll & Zoom:

  • Scroll direction: Natural: Disabled
@joshkautz
joshkautz / $macOS Big Sur 11.1: System Preferences → Battery.md
Last active December 27, 2020 20:54
macOS Big Sur 11.1: System Preferences → Battery

System Preferences → Battery → Battery:

  • Show battery status in menu bar: True
  • Turn display off after: Never
  • Slightly dim the display while on battery power: True
  • Enable Power Nap while on battery power: False
  • Optimize video streaming while on battery: True
  • Optimized battery charging: True

System Preferences → Battery → Power Adapter:

  • Show battery status in menu bar: True
@joshkautz
joshkautz / output.json
Last active November 28, 2020 21:50
TSP implementation for StackOverflow support
{'Dropped': [5, 8, 9, 20, 21, 22, 25, 27, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41], 'Scheduled': [[0, 21600, 21600], [14, 21964, 21982], [15, 24235, 24253], [10, 26468, 26486], [12, 28494, 28512], [11, 30568, 30586], [13, 32677, 32695], [23, 34869, 34887], [29, 37037, 37055], [24, 39103, 39121], [7, 41413, 41431], [3, 43898, 43916], [2, 46266, 46284], [4, 48674, 48692], [6, 51672, 51690], [17, 53921, 53939], [19, 56163, 56181], [18, 58543, 58561], [26, 60553, 60571], [16, 62703, 62721], [1, 64800, 64800]]}