Skip to content

Instantly share code, notes, and snippets.

View stevengonsalvez's full-sized avatar
💭
trying to be monkish

Steven Gonsalvez stevengonsalvez

💭
trying to be monkish
View GitHub Profile
@stevengonsalvez
stevengonsalvez / account_client.go
Created February 21, 2023 16:44 — forked from sebnyberg/account_client.go
Some Azure Go SDK auth things
package azurex
import (
"context"
"errors"
"fmt"
"os"
"strings"
"github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/resources/mgmt/subscriptions"
@stevengonsalvez
stevengonsalvez / default-server-platform-response-api.js
Created January 25, 2023 17:00
default-server-platform-response-api.js
const express = require('express')
const os = require('os')
const app = express()
const port = process.env.APP_PORT || 80
var response = '<html><body> <h1>'
response += 'Hello from' + os.hostname() + '</h1>'
response += 'Type:' + os.type() + '<br/>'
@stevengonsalvez
stevengonsalvez / clipper-obsidian.js
Last active January 17, 2023 18:20
alternate-obsidian-web-clipper.js
javascript: Promise.all([import('https://unpkg.com/[email protected]?module'), import('https://unpkg.com/@tehshrike/[email protected]'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@stevengonsalvez
stevengonsalvez / obsidian-web-clipper.js
Last active January 6, 2023 22:52 — forked from kepano/obsidian-web-clipper.js
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/[email protected]?module'), import('https://unpkg.com/@tehshrike/[email protected]'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
de() {
  set -o allexport
  eval $(cat '.env' | sed -e '/^#/d;/^\s*$/d' -e 's/\(\w*\)[ \t]*=[ \t]*\(.*\)/\1=\2/' -e "s/=['\"]\(.*\)['\"]/=\1/g" -e "s/'/'\\\''/g" -e "s/=\(.*\)/='\1'/g")
  set +o allexport
}

Using Azure CLI to add cert and hostname to web apps

These notes assume that you already have an app service plan running a number of sites (web apps) that ALL want the same wildcard cert.

The problem being solved was how to point a number of sites to a company domain.

The aliases (e.g. alias trainer.foo-uk.com onto CNAME pvb-live-eun-trainer-as.azurewebsites.net) MUST already be configured in DNS -- Azure will check!

First, how to get the interesting App Service Plan

@stevengonsalvez
stevengonsalvez / github_runs_delete.py
Created May 4, 2022 22:58
delete workflow runs github actions
import grequests
import requests
import secrets as s
from time import perf_counter
# secrets.py
# username = "xxxx"
# repo = "xxxx"
# token = "xxxx"
@stevengonsalvez
stevengonsalvez / jq-cheetsheet.md
Created April 11, 2022 10:07 — forked from olih/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@stevengonsalvez
stevengonsalvez / god-mode-clean.yml
Last active July 5, 2022 12:34
god mode clean azure action pipe
name: GOD-MOD-Clean-up
on:
workflow_dispatch:
inputs:
AZURE_CREDENTIALS:
description: 'AZURE_CREDENTIALS as secrets in the format {"clientId": "<GUID>","clientSecret": "<GUID>","subscriptionId": "<GUID>","tenantId": "<GUID>" }'
required: false
jobs:
get-stuff-to-delete:
@stevengonsalvez
stevengonsalvez / myagnoster.zsh-theme
Created January 4, 2022 12:59
agnoster with time
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline