This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Cryptography utilities that utilize the Web Crypto API | |
// By default, the AES-GCM algorithm is used for encryption and decryption. | |
const DEFAULT_ENCRYPTION_ALGORITHM = "AES-GCM"; | |
export function isCryptoSupported() { | |
return window.crypto && window.crypto.subtle && window.crypto.subtle.importKey; | |
} | |
async function buildEncryptionKey( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Document</title> | |
</head> | |
<script> | |
const issueId = window.location.search; // TODO: clean up parsing of issue id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env npx jsh | |
usage(` | |
Usage: | |
${$0} service_type | |
Examples: | |
${$0} ELECTRICITY | |
${$0} WATER | |
Downloads usage information from Colorado Springs Utilities |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource = Aws::S3::Resource.new(client: Aws::S3::Client.new) | |
url = resource.bucket('my-bucket').object('myfolder/foo.txt').presigned_url(:put) | |
put url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This function will check to see if a module is installed and if not will run `npm install` to install all dependencies. | |
* Then, the module will be required and returned. | |
* The intended usage is for a consumer to be able to require a module even if npm install has not been run beforehand. | |
* Source: https://stackoverflow.com/a/53377794/626911 | |
* | |
* Example usage: | |
* const requireOrInstall = require("./helpers/require-or-install"); | |
* axios = await requireOrInstall("axios"); | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source :https://stackoverflow.com/a/67000032/626911 | |
org=<your org> | |
repo=<your repo> | |
# Get workflow IDs with status "disabled_manually" | |
workflow_ids=($(gh api repos/$org/$repo/actions/workflows | jq '.workflows[] | select(.["state"] | contains("disabled_manually")) | .id')) | |
for workflow_id in "${workflow_ids[@]}" | |
do | |
echo "Listing runs for the workflow ID $workflow_id" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git-move() { | |
echo "Moving commits on current branch to a new branch..." | |
# This is useful if commits were mistakenly made on master and need to be move to a new branch. | |
# $1 - New target branch name | |
if [ -z "$1" ]; then echo "New branch name required!"; exit 0; fi | |
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
echo "Moving local commits on ${CURRENT_BRANCH} to $1" | |
git branch ${1} && git reset --hard origin/${CURRENT_BRANCH} && git checkout ${1} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TOKEN=123; curl -Ss -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \ | |
"https://api.github.com/repos/username/repo_name/releases?per_page=100&page=1" \ | |
| jq -r '.[] | select(.draft == true) | .id' \ | |
| xargs -I {} -L 1 \ | |
curl -L -H "Authorization: token $TOKEN" -X DELETE "https://api.github.com/repos/username/repo_name/releases/{}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Pollster - The SmartThings Polling Daemon. | |
* | |
* Pollster works behind the scenes and periodically calls 'poll' or | |
* 'refresh' commands for selected devices. Devices can be arranged into | |
* three polling groups with configurable polling intervals down to 1 minute. | |
* | |
* Please visit [https://github.com/statusbits/smartthings] for more | |
* information. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT set_config('current.user', 'my_user', false); | |
SELECT set_config('current.dbname', 'my_database', false); | |
CREATE USER current_setting('current.user'); | |
-- Give CREATE, CONNECT, TEMPORARY permissions | |
GRANT ALL PRIVILEGES ON DATABASE current_setting('current.dbname') TO current_setting('current.user'); | |
-- Grant INSERT, UPDATE, DELETE access to all EXISTING tables in public schema | |
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO current_setting('current.user'); |
NewerOlder