Skip to content

Instantly share code, notes, and snippets.

View sistlm's full-sized avatar
💭
I may be slow to respond.

Sistla sistlm

💭
I may be slow to respond.
View GitHub Profile
@sistlm
sistlm / s3podcast.js
Created December 15, 2021 16:59 — forked from ngs/s3podcast.js
const AWS = require('aws-sdk');
const s3 = new AWS.S3();
exports.handler = async (event) => {
const filename = 'feed.xml';
const { bucket, object } = event.Records[0].s3;
const { eventTime, awsRegion } = event.Records[0];
const date = new Date(eventTime).toUTCString();
console.info(JSON.stringify(event, null, 2));
const res = await s3.getObject({ Bucket: bucket.name, Key: filename }).promise();
/**
* Responds to any HTTP request.
*
* @param {!express:Request} req HTTP request context.
* @param {!express:Response} res HTTP response context.
*/
const fetch = require('node-fetch');
exports.handle = async (req, res) => {
@sistlm
sistlm / inspect.sh
Created December 15, 2021 16:58 — forked from ngs/inspect.sh
MusicDir = /home/pi/music
ALSADevice = default
ALSAMixer1 = Headphone
#ALSAMixer2 = Master
ALSAStutterDefeat = no
# /etc/systemd/system/gpio-watch.service
[Unit]
Description=gpio-watch is a tool for running scripts in response to GPIO events.
[Service]
User=root
WorkingDirectory=/root
ExecStart=/usr/bin/gpio-watch 6:rising
Restart=always
@sistlm
sistlm / colors.js
Created December 15, 2021 16:57 — forked from ngs/colors.js
// http://jan5.fc2web.com/model/mr_color.html
[cols, ...rows] = $$('table[border="1"] tr').map(tr => Array.from(tr.childNodes).filter(cn => cn.nodeName === 'TD').map(td => td.getAttribute('bgcolor') || td.innerText))
'| ' + cols.join(' | ') + ' |\n| ---- | ---- | ---- | ---- | ---- | ---- |\n| ' + rows.map(row => row.join(' | ').replace(/\n/g, '<br>')).join(' |\n| ').replace(/#([A-F0-9]{6})/g, '![$1](https://dummyimage.com/20x20/$1/fff&text=+)')
# https://docs.docker.com/engine/install/ubuntu/
apt-get update -y
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
@sistlm
sistlm / main.tf
Created December 15, 2021 16:45 — forked from jhanley-com/main.tf
Terraform Azure Service Principal - Part 1
# Test code for the question: https://stackoverflow.com/q/65525116/8016720
# Provides configuration details for the Azure Terraform provider
provider "azurerm" {
# !!! Must include features even if empty
features {}
}
variable "appName" { default = "testAppName" }
variable "subscriptionId" { default = "" }
@sistlm
sistlm / .gitignore
Created December 15, 2021 16:45 — forked from isaacarnault/.gitignore
AWS VPC using Terraform and Jenkins integration
________ ________ ___ __ ___
|\_____ \|\ __ \|\ \|\ \ |\ \
\|___/ /\ \ \|\ \ \ \/ /|\ \ \
/ / /\ \ __ \ \ ___ \ \ \
/ /_/__\ \ \ \ \ \ \\ \ \ \ \
|\________\ \__\ \__\ \__\\ \__\ \__\
\|_______|\|__|\|__|\|__| \|__|\|__|
ignore Azure, GCP
@sistlm
sistlm / gist:03542fd52294ea6f3c0ae034b35a670b
Created December 15, 2021 16:43 — forked from mrlesmithjr/gist:72e23d0a0cceefef553b83b4fce5d06f
Example GitLab CI Pipeline using Terraform, etc.
---
# Most pre-req tooling, etc. is installed using jumphosts.yml playbook
variables:
ADMIN_EMAIL: mrlesmithjr@gmail.com
CLOUD_PROVIDER: Azure # Define Supported Cloud Provider (Azure)
GIT_CRYPT_ENABLED: "true" # Must be lowercase (true|false)
GIT_SUBMODULE_STRATEGY: recursive
ORGANIZATION: example_org
PROJECT_NAME: example_project
TERRAFORM_VERSION: 0.12.28
@sistlm
sistlm / format-terraform-cli-args.py
Created December 15, 2021 16:42 — forked from martingutierrezg/format-terraform-cli-args.py
Python script - Azure DevOps - Format Terraform Command Line Arguments
#!/usr/bin/python3
import sys
import re
terraform_plan_command_str = ''.join(sys.argv[1:])
# terraform_plan_command_str = ""
plan_splits = terraform_plan_command_str.rpartition("false")
plan_first_split = plan_splits[0] + plan_splits[1]
plan_second_split = plan_splits[2]