Skip to content

Instantly share code, notes, and snippets.

@htnosm
htnosm / echo-awscli.sh
Last active July 3, 2022 04:15
Output aws cli command in bash script
#!/usr/bin/env bash
# Output aws cli command in bash script
# Usage: echo-awscli.sh scriptPath [arg1 arg2 ...]
shopt -s expand_aliases
# mocks
function aws_cli_mock() {
case $@ in
@htnosm
htnosm / _example-tf-unixtime.md
Last active August 20, 2022 08:39
Example of inter-conversion between datetime string and Unixtime in Terraform

example-tf-unixtime

Example of inter-conversion between datetime string and Unixtime in Terraform.

@htnosm
htnosm / NewRelic-Dashboard-ManageDataAdditionalInformation.json
Last active December 4, 2022 20:38
New Relic manage data additional information dashboard
{
"name": "Manage Data Additional Information",
"description": null,
"permissions": "PUBLIC_READ_WRITE",
"pages": [
{
"name": "Ingest Resource Request Per Minute",
"description": null,
"widgets": [
{
@htnosm
htnosm / aws-cloudshell-cred.sh
Created August 6, 2023 21:54
Get the credentials from AWS CloudShell and output to credential file format.
#!/usr/bin/env bash
# aws-cloudshell-cred.sh
# Get the credentials from AWS CloudShell and output to credential file format.
CONTAINER_CREDENTIALS=$(curl -sSf -H "Authorization: ${AWS_CONTAINER_AUTHORIZATION_TOKEN}" "${AWS_CONTAINER_CREDENTIALS_FULL_URI}")
if [ $? -ne 0 ]; then
echo "failed get container credentials."
exit 1
fi
@htnosm
htnosm / tfc_resource_count.gas
Last active July 18, 2024 21:53
Fetch resource counts of HPC Terraform
/**
* Fetch resource counts of HPC Terraform
*
* Usage:
* - Run the `setUserPreference` function to register your API_TOKEN and ORGANIZATION in the script's properties.
* - You can verify the stored properties using the log output of the `getUserPreference` function.
* - Set a periodic trigger to execute the "getTerraformData" function.
*/
const BASE_URL = "https://app.terraform.io/api/v2";