Skip to content

Instantly share code, notes, and snippets.

View the-codinator's full-sized avatar
🎧
May the `code` be with you!

Pratik Panchal the-codinator

🎧
May the `code` be with you!
View GitHub Profile
import { createNamespace } from 'cls-hooked';
// https://www.npmjs.com/package/cls-hooked
interface MyContext {
// ...
}
const ns = createNamespace('abc');
const key = 'context';
@the-codinator
the-codinator / org.codi.backup.work.plist
Created November 14, 2020 12:32
launchd driver script for auto-commit.sh
<!-- Data backup launchd agent for work directory -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.codi.backup.work</string>
<key>WorkingDirectory</key>
@the-codinator
the-codinator / auto-commit.sh
Last active November 14, 2020 12:43
A script that automatically commits changes to stuff in a directory
#!/bin/bash
# Script to auto commit all changes in a specific repository
# Run this with a scheduler like launchd or systemd
REMOTE=origin
BRANCH=master
DIR="$1"
[[ -z "$DIR" ]] && DIR="."
@the-codinator
the-codinator / bash-stuff.sh
Last active September 25, 2023 18:37
Some good to have configs for bash (or zsh) for your terminal
###################
##### SOURCES #####
###################
##### Aliases #####
## Git
export GH_HOST=github.com
function clone { [[ -z "$1" ]] && echo "Error: Missing repo name parameter" && return 2; local git_org=$(basename $(pwd)); echo "Cloning [$git_org/$1] ..."; git clone "git@$GH_HOST:$git_org/$1.git"; }
@the-codinator
the-codinator / azure-storage-blob-container-sas-uri.js
Last active December 24, 2020 05:51
Create a Service SAS URI for an Azure Blob Storage Container
/* Script to create a serive SAS URI for an Azure Blob Storage Container */
const { generateBlobSASQueryParameters, SASProtocol, StorageSharedKeyCredential } = require('@azure/storage-blob'); // v12.x
function generageBlobSasSignatureValues(blobContainerName, storedPolicyName, overrides) {
const startsOn = new Date();
const expiresOn = new Date(startsOn.getTime() + 86400_000); // 1 day - customizable
const permissions = storedPolicyName ? undefined : 'racwl'; // All but delete, Max permissions are 'racwdl'
// Stored Access Policy (for the container) defines the permissions and optionally startsOn & expiresOn
// Using an Access Policy allows us to invalidate SAS by deleting the policy
/**
* TST v3.8.19
*
* Components: https://github.com/piroor/treestyletab/tree/trunk/webextensions/sidebar/components
* Base CSS: https://github.com/piroor/treestyletab/blob/trunk/webextensions/sidebar/styles/base.css
*/
/* Note: select "No Decoration" under themes to apply these */
/* Root variables */
@the-codinator
the-codinator / cli-tools.md
Last active July 3, 2024 23:40
Useful CLI tools to have for you shell

Useful CLI tools to have for you shell

Almost everything here is installable via homebrew

Common

  • Json Parser: jq
  • GitHub CLI: gh
  • Google zx: zx
  • Compression: zip, unzip, tar