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 / PingRdpPort.ps1
Created August 20, 2015 16:42
Determine if a specified server is listening on the default RDP port
# relies on portqry (see http://www.microsoft.com/en-us/download/details.aspx?id=24009)
param (
[Parameter(Mandatory=$true)]
[string]
$server,
[int]
$rdpPort = 3389
)
@drmohundro
drmohundro / ConstraintsInPlayground.swift
Created March 5, 2016 21:28
Playing with Layout Constraints and VFL in Swift Playground
// 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 / fix-casing-issues.rb
Created March 11, 2016 21:46
Fix git casing issues across all directories
# 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 / Open-MruSolution.ps1
Last active May 17, 2016 14:15
PowerShell script to open a recently used solution in Visual Studio
function Open-MruSolution($sln) {
$mruItems = "HKCU:\Software\Microsoft\VisualStudio\14.0\MRUItems"
$guids = Get-ChildItem $mruitems |
Select-Object -ExpandProperty name |
Foreach-Object { $_.Substring($_.LastIndexOf('\') + 1) }
[array]$mostRecentlyUsedSlns = $guids |
Foreach-Object {
$guid = $_
Get-ChildItem "$mruItems\$guid" |
@drmohundro
drmohundro / backup-example.sql
Last active January 4, 2017 01:58
Backup and Restore Database Examples (T-SQL)
BACKUP DATABASE MyDb TO DISK = 'C:\sql-backups\MyDb-20151119.bak' WITH INIT
GO
@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
@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 / private.xml
Last active September 21, 2017 00:36
Karabiner private.xml to swap option and command keys for Parallels
<?xml version="1.0"?>
<root>
<appdef>
<appname>PARALLELS</appname>
<equal>com.parallels.desktop.console</equal>
</appdef>
<devicevendordef>
<vendorname>MICROSOFT</vendorname>
<vendorid>0x045e</vendorid>
@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 / 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>