Skip to content

Instantly share code, notes, and snippets.

David Mohundro drmohundro

Block or report user

Report or block drmohundro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@drmohundro
drmohundro / example.swift
Last active Mar 9, 2018
Linux namespace and SWXMLHash
View example.swift
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 Dec 16, 2017
GhostScript PDF to text stdout
View pdf-to-txt.sh
# 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
View 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 Jan 4, 2017
T-SQL sp_msforeachdb example
View for-each-db-example.sql
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 Jan 4, 2017
T-SQL Has More Than CTE Example
View has-more-than-one-example.sql
; 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
@drmohundro
drmohundro / backup-example.sql
Last active Jan 4, 2017
Backup and Restore Database Examples (T-SQL)
View backup-example.sql
BACKUP DATABASE MyDb TO DISK = 'C:\sql-backups\MyDb-20151119.bak' WITH INIT
GO
@drmohundro
drmohundro / fix-casing-issues.rb
Created Mar 11, 2016
Fix git casing issues across all directories
View fix-casing-issues.rb
# can just run this in pry
files = `git ls-files | grep Wrongcase`
files.split("\n").each { |file| system("git mv #{file} #{file.gsub('Wrongcase', 'WrongCase')}") }
@drmohundro
drmohundro / ConstraintsInPlayground.swift
Created Mar 5, 2016
Playing with Layout Constraints and VFL in Swift Playground
View ConstraintsInPlayground.swift
// playing with Xcode, Constraints and Playground
import UIKit
import XCPlayground
let hostView = UIView()
hostView.frame = CGRectMake(0, 0, 400, 200)
hostView.backgroundColor = UIColor.lightGrayColor()
XCPlaygroundPage.currentPage.liveView = hostView
@drmohundro
drmohundro / scm-ignore.js
Created Jan 24, 2016
Bookmarklet to hide rows on various source hosting sites
View scm-ignore.js
var url = window.location.href;
var searchTextToIgnore = prompt('Enter text to ignore:');
if (url.match(/bitbucket/)) {
$('h1:contains(' + searchTextToIgnore + ')').closest('section').hide();
} else if (url.match(/gitlab/)) {
$('.diff-header span:contains(' + searchTextToIgnore + ')').parent().parent().hide();
} else {
alert(url + " doesn't match any known sites.");
}
@drmohundro
drmohundro / PingRdpPort.ps1
Created Aug 20, 2015
Determine if a specified server is listening on the default RDP port
View PingRdpPort.ps1
# relies on portqry (see http://www.microsoft.com/en-us/download/details.aspx?id=24009)
param (
[Parameter(Mandatory=$true)]
[string]
$server,
[int]
$rdpPort = 3389
)
You can’t perform that action at this time.