Skip to content

Instantly share code, notes, and snippets.

View drmohundro's full-sized avatar
:shipit:

David Mohundro drmohundro

:shipit:
View GitHub Profile
@drmohundro
drmohundro / clone-github-org.sh
Created March 19, 2025 14:20
Archive a GitHub Org Bash Script
#!/bin/bash
# Check if the organization or user is provided as a command-line argument
if [ -z "$1" ]; then
echo "Usage: $0 <organization_or_user>"
exit 1
fi
# Set the organization or user from the command-line argument
ORG_OR_USER="$1"
@drmohundro
drmohundro / obsidian-templater-weather.js
Created February 11, 2025 16:02
Obsidian Templater Snippet to display weather
const forecast = await fetch("https://wttr.in/Memphis?format=j1").then((res) =>
res.json(),
);
const temp = forecast.current_condition[0].temp_F;
const feelsLike = forecast.current_condition[0].FeelsLikeF;
const description = forecast.current_condition[0].weatherDesc[0].value;
const weatherCode = forecast.current_condition[0].weatherCode;
// via https://github.com/chubin/wttr.in/blob/4d384f9efe727b28a595d4f502bcb9593fa19c99/lib/constants.py
@drmohundro
drmohundro / FluentTypeGenerator.cs
Created February 19, 2021 01:27
FluentTypeGenerator - Old POC I did for a fluent type generator class
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.IO;
using System.Web;
using Omitted.Utilities.SystemTypeExtensions;
namespace Omitted.Services.Forms.Core.Clients.Generation
{
@drmohundro
drmohundro / stackoverflow-question.swift
Last active August 24, 2020 16:36
StackOverflow Question - SWXMLHash Test
import SWXMLHash
let xml = """
<root>
<catalog>
<book><author>Bob</author></book>
<book><author>John</author></book>
<book><author>Mark</author></book>
</catalog>
</root>
@drmohundro
drmohundro / pipelines.ps1
Created May 26, 2020 22:10
Get sqlcmd.exe in Azure Pipelines
$ErrorActionPreference = 'Stop';
Invoke-WebRequest 'https://vstsagenttools.blob.core.windows.net/tools/SQLCMD/11.0/SQLCMD.zip' -OutFile sqlcmd.zip
try {
Add-Type -AssemblyName System.IO.Compression.FileSystem
} catch { };
[System.IO.Compression.ZipFile]::ExtractToDirectory('./sqlcmd.zip', './')
@drmohundro
drmohundro / example.swift
Last active March 9, 2018 02:47
Linux namespace and SWXMLHash
let podcastURL = URL(string: "http://feed.thisamericanlife.org/talpodcast")!
let contents = """
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:media="http://search.yahoo.com/mrss/" version="2.0" xml:base="https://www.example.com">
<channel>
<title>Some Title</title>
<link>https://www.example.com</link>
<description>some awesome feed.</description>
<language>en</language>
<copyright>Copyright 1995-3001</copyright>
<itunes:author>John Doe</itunes:author>
@drmohundro
drmohundro / pdf-to-txt.sh
Created December 16, 2017 17:34
GhostScript PDF to text stdout
# requires ghostscript to be installed first - on mac, install with `brew install ghostscript`
# -sDEVICE=txtwrite - text writer
# -sOutputFile=- - use stdout instead of a file
# -q - quiet - prevent writing normal messages to output
# -dNOPAUSE - disable prompt and pause at end of each page
# -dBATCH - indicates batch operation so exits at end of processing
gs -sDEVICE=txtwrite -sOutputFile=- -q -dNOPAUSE -dBATCH to-be-processed.pdf
@drmohundro
drmohundro / keybase.md
Created October 14, 2017 03:42
keybase.md

Keybase proof

I hereby claim:

  • I am drmohundro on github.
  • I am drmohundro (https://keybase.io/drmohundro) on keybase.
  • I have a public key ASDfnjmOHn27rh_MABD4tr3t-bugI4x2mzGyBU82z3pxzgo

To claim this, I am signing this object:

@drmohundro
drmohundro / for-each-db-example.sql
Created January 4, 2017 02:03
T-SQL sp_msforeachdb example
EXEC sp_msforeachdb '
if ''?'' LIKE ''CMS[_]%'' begin
print ''?'';
use [?]
select setting as TransactionGateway, ''?'' as [Database]
from dbo.Setting with(nolock)
where Id = ''TransactionGateway''
@drmohundro
drmohundro / has-more-than-one-example.sql
Created January 4, 2017 01:59
T-SQL Has More Than CTE Example
; WITH ForImport AS (
SELECT
DISTINCT
ve.BvcmsId
,vd.account AS CreditCardOrAch
,vd.account_expiration AS Expires
,vd.routing AS Routing
,vd.address1 AS Address1
,vd.address2 AS Address2
,vd.city AS City