Skip to content

Instantly share code, notes, and snippets.

Avatar

Dave Farinelli dfar-io

View GitHub Profile
@dfar-io
dfar-io / pfx-le-cert.sh
Created Oct 8, 2020
Creates a Let's Encrypt Cert using TXT record verification and converts to PFX
View pfx-le-cert.sh
# Creates a PFX certificate using CertBot
#
# TODO: Use hooks to implement automation via GoDaddy
# https://certbot.eff.org/docs/using.html#hooks
# exit when any command fails
set -e
if [ "$1" == "" ] || [ "$2" = "" ]
then
@dfar-io
dfar-io / loggly-endpoint.cs
Last active Jun 15, 2020
A .NET Core Azure function that forwards EventHub events to a Loggly endpoint
View loggly-endpoint.cs
#r "Microsoft.Azure.EventHubs"
using System;
using System.Text;
using Microsoft.Azure.EventHubs;
public static async Task Run(EventData[] events, ILogger log)
{
var exceptions = new List<Exception>();
@dfar-io
dfar-io / extract-bold360-chats.sh
Created Jun 5, 2020
Extracts all Bold360 Chats from an account
View extract-bold360-chats.sh
#!/bin/bash
# Gets all chat messages from a Bold360 account
# you can easily pipe this to output file with:
# ./extract-bold-chat.sh | jq '.Data' > output.json
accountId=[YOUR_ACCOUNT_KEY]
apiSettingId=[YOUR_API_SETTING_KEY]
apiKey=[YOUR_API_KEY]
@dfar-io
dfar-io / vertically-centered-modal
Last active Jun 5, 2020
Provides a link to JSFiddle with vertically centered modal
View vertically-centered-modal
// Can be found at https://jsfiddle.net/jkem8nsz/49/
// HTML
<a href="#" id="text">
click to show modal<br >
</a>
<div id="modal" class="modal-outer">
<div class="modal-middle">
<div class="modal-inner">
@dfar-io
dfar-io / Copy-Sql-Db.ps1
Created May 28, 2020
Copies a SQL Server database with a different name.
View Copy-Sql-Db.ps1
<#
Backs up and optionally restores a SQL Server database.
#>
param (
[Parameter(Mandatory, Position=0)][string]$backupDbName,
[Parameter(Position=1)][string]$restoreDbName
)
$timestamp = $(((get-date).ToUniversalTime()).ToString("yyyyMMddTHHmmssZ"));
View kbb-scrape
# Gets the trade-in value on KBB
var rangeBox = document.getElementById("RangeBox")
var html = rangeBox.innerHTML
html.substring(html.indexOf("y=\"-8") + 8, html.lastIndexOf("</"))
@dfar-io
dfar-io / add-k8s-context.sh
Created Jul 10, 2019
Programmatically adds a AKS cluster to a Ubuntu box
View add-k8s-context.sh
#!/bin/bash
set -e
set -o pipefail
if [ "$1" == "" ]
then
echo "AKS RG is required."
exit 1
fi
if [ "$2" == "" ]
You can’t perform that action at this time.