Skip to content

Instantly share code, notes, and snippets.

View shazron's full-sized avatar
😆

Shazron Abdullah shazron

😆
View GitHub Profile
@shazron
shazron / github-search-substring-in-repo.js
Created March 30, 2023 08:50
Search for a substring in a Github Repo. Generated by ChatGPT-4.
const searchSubstringInRepo = async (owner, repo, substring) => {
const repoApiUrl = `https://api.github.com/repos/${owner}/${repo}/git/trees/master?recursive=1`;
const headers = {
'Accept': 'application/vnd.github+json',
'Authorization': 'token YOUR_PERSONAL_ACCESS_TOKEN'
};
try {
const response = await fetch(repoApiUrl, { headers });
if (!response.ok) {
@shazron
shazron / create-macos-monterey.sh
Created June 30, 2022 12:20
Create a macOS Monterey .iso file from the .app installer
# adapted from https://osxdaily.com/2020/07/20/how-convert-macos-installer-iso/
hdiutil create -o /tmp/Monterey -size 13700m -volname Monterey -layout SPUD -fs HFS+J
hdiutil attach /tmp/Monterey.dmg -noverify -mountpoint /Volumes/Monterey
sudo /Applications/Install\ macOS\ Monterey.app/Contents/Resources/createinstallmedia --volume /Volumes/Monterey --nointeraction
hdiutil detach /volumes/Install\ macOS\ Monterey
@shazron
shazron / url-join-path.js
Last active May 13, 2022 03:13
alternative to url-join or proper-url-join node modules
const path = require('path')
const assert = require('assert')
function urlJoinPath(url, pathToAdd) {
const u = new URL(url)
u.pathname = path.posix.join(u.pathname, pathToAdd)
return u.href
}
let result1 = urlJoinPath('https://foo.bar/a/b', 'recordlogin')

Description

Monterey has a bug that is impacting global mute functionality in the OS when using any audio bluetooth devices such as AirPods. When global OS mute is used it is muting both the input and the output when the desired outcome would be to only mute the input. This problem did not exist on Big Sur. It appears that in macOS Monterey there was a change made to how devices are classified (it is clearly a bug), that change on the backend of the operating system is causing all types of issues for any device that exercised control over headsets or microphones.

Here are some steps to reproduce on macOS Monterey:

  1. Connect any bluetooth headset to the computer.
  2. Open default "audio MIDI setup" application which is a default macOS application.
  3. Find the headset you connected via bluetooth and find the input pane it might show up as two seperate devices.
  4. Play any audio source including playing a clip from youtube.
@shazron
shazron / .zshrc
Created March 23, 2022 07:36
iterm2-add-working-directory-name-as-tab-title
if [ $ITERM_SESSION_ID ]; then
precmd() {
echo -ne "\033]0;${PWD##*/}\007"
}
fi
@shazron
shazron / launch.json
Created January 9, 2020 04:48
vscode jest launch config (excludes node_modules and internal node files)
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest All",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["--runInBand"],
"console": "integratedTerminal",
@shazron
shazron / findgrep
Created November 28, 2019 17:14
Recursively find files of a certain filename, and search for a string in the file. Exclude folders such as node_modules
find . -type d -name FOLDER_TO_EXCLUDE_FROM_SEARCH -prune -o -type f -name FILENAME_TO_FIND -print | xargs grep PATTERN_TO_SEARCH_IN_FILE
@shazron
shazron / aoe2hd.md
Created May 16, 2019 03:03 — forked from yocontra/aoe2hd.md
Age of Empires II HD - For Mac OSX
@shazron
shazron / delete_all_greenkeeper_branches.sh
Last active April 8, 2021 13:44
Delete all Greenkeeper branches
#!/bin/bash
# Description:
# Delete all `greenkeeper/*` branches of your remote.
# Instructions:
# Run the script with the `--help` flag.
ORIGIN=origin
DRY_RUN=0
THIS=`basename "$0"`
@shazron
shazron / update_all.sh
Last active September 4, 2018 07:34
Update named repos in a Github Organization
#! /bin/bash
# simple update, nothing fancy, gets things done
# run from the parent folder CWD (all repos will are siblings)
# EDIT: this is the Org for the repos
GH_ORG="adobe"
# EDIT: this is the base url for the repos (Github.com)
BASE_URL="https://github.com/$GH_ORG"
# EDIT: add the repo name to this list