Skip to content

Instantly share code, notes, and snippets.

View shazron's full-sized avatar
😆

Shazron Abdullah shazron

😆
View GitHub Profile
@shazron
shazron / python-pyenv-macos.md
Created October 9, 2024 02:56 — forked from samuelbradshaw/python-pyenv-macos.md
Installing Python 2 and 3 on macOS

Installing Python 2 and 3 on macOS

Starting with macOS 12.3, Python is no longer bundled with macOS. These instructions allow you to set up Python 2 and Python 3 side-by-side using pyenv. The instructions were tested on an Apple Silicon Mac, but the process on an Intel Mac should be similar.

Install Homebrew

Homebrew is a popular package manager that makes it easy to install command line tools. If you don’t yet have Homebrew installed, instructions can be found here: https://brew.sh

Verify that Homebrew is installed:

@shazron
shazron / profile.ps1
Last active June 24, 2024 14:36
Powershell, launch fork.exe with a directory path
# From https://github.com/fork-dev/TrackerWin/issues/416#issuecomment-1246248261
#
# Launch fork.exe from the command line with a directory path argument.
#
# App: https://git-fork.com/
# Usage: fork <directory_path>
#
# Load your profile in Notepad:
# notepad $PROFILE
# Then, add the contents below:
@shazron
shazron / update_front_matter_title_from_heading.js
Last active May 23, 2024 05:16
Update the front-matter title property of Markdown files from the first heading title
const fs = require('node:fs');
const path = require('node:path');
const matter = require('gray-matter');
const MarkdownIt = require('markdown-it');
const MarkdownItFrontMatter = require('markdown-it-front-matter');
if (!matter || !MarkdownIt || !MarkdownItFrontMatter) {
console.error('Module "gray-matter", "markdown-it", or "markdown-it-front-matter" not found. Run "npm install"');
process.exit(1);
}
@shazron
shazron / delete_all_actions.sh
Last active March 19, 2024 12:17
Deleting all actions in a Adobe Runtime namespace
# install jq: https://jqlang.github.io/jq/
# list all packages
aio rt package list --json | jq '.[] | .name'
# for each package name, delete the package recursively
aio rt package delete "MY_PACKAGE_1" --recursive
@shazron
shazron / stringify-parse-test.js
Created February 22, 2024 06:22
JSON.stringify / parse tests for state
let store = {}
/** @private */
function put (key, value) {
store[key] = JSON.stringify(value)
}
/** @private */
function get (key) {
const value = store[key]
@shazron
shazron / blob.buffer.utils.js
Created October 30, 2023 01:38
blob2buffer and buffer2blob
const { Blob } = require('node:buffer');
/**
* Converts a Buffer to a Blob.
*
* @param {Buffer} buffer the Buffer to convert
* @returns {Blob} the converted Buffer as a Blob
*/
function buffer2blob(buffer) {
if (buffer instanceof Buffer === false) {
@shazron
shazron / .zshrc
Created September 21, 2023 14:18
iTerm2 - show current folder name in tab title
if [ $ITERM_SESSION_ID ]; then
precmd() {
echo -ne "\033]0;${PWD##*/}\007"
}
fi
@shazron
shazron / Google Ad Privacy Settings.md
Last active September 9, 2023 17:16
Google Ad Privacy Preferences json settings

Google Ad Privacy Settings (JSON)

Sept 10th 2023

Location

  1. In Google Chrome, go to chrome://settings/adPrivacy
  2. In Windows, make sure Chrome is closed, and load the file %LOCALAPPDATA%\Google\Chrome\User Data\Default\Preferences in a text editor and format it as JSON.

Chrome Ad Privacy Notice

@shazron
shazron / index.cjs
Last active August 28, 2023 01:57
OpenWhisk - how to use an EcmaScript Module (ESM) in node.js
// ///////////////////////////////////////////////////////////////////
// index.cjs - this is exported in the manifest for Openwhisk Deploy
// Only supported in Node 14+ (dynamic import)
async function cjsMain(params) {
const { default: esmMain } = await import('./index.mjs')
return esmMain(params)
}
exports.main = cjsMain