Skip to content

Instantly share code, notes, and snippets.

View mjdescy's full-sized avatar

Michael Descy mjdescy

View GitHub Profile
@mjdescy
mjdescy / Searches
Last active August 29, 2015 13:59
Windows 7 Saved Searches
# Today's Files
datemodified:today NOT type:folder NOT (.git)
# Yesterday's Files
datemodified:yesterday NOT type:folder NOT (.git)
# Earlier This Week
datemodified:earlier this week NOT type:folder NOT (.git)
# Today's Folders
@mjdescy
mjdescy / ACL Script To Pull Random Attribute Sample
Last active August 29, 2015 13:59
ACL Script To Pull Random Attribute Sample
COMMENT Script: Pull random attribute sample.
COMMENT
Before using this script,
1. set the SampleSize variable;
2. replace "PopulationTable" with the population table name; and
3. replace "SampleTable" with the sample table name.
END
COMMENT Define sample size.
@mjdescy
mjdescy / Microsoft Access Execute SQL Function
Last active August 29, 2015 13:59
Microsoft Access Execute SQL VBA Function
Private Sub ExecSQL(ByVal SQL As String)
Call CurrentDb.Execute(SQL, dbFailOnError)
End Sub
@mjdescy
mjdescy / Microsoft Access Drop Primary Key Constraint SQL
Created April 14, 2014 20:55
Microsoft Access Drop Primary Key Constraint SQL
ALTER TABLE TableName DROP CONSTRAINT PrimaryKey;
@mjdescy
mjdescy / FileNameReplace
Created May 7, 2014 17:59
Windows PowerShell Batch Rename Files
dir | Rename-Item -NewName { $_.name -replace "OldText", "ReplacementText" }
@mjdescy
mjdescy / pia.sh
Last active August 29, 2015 14:20 — forked from dapperfu/pia.sh
#!/bin/tcsh
# Grab user information.
echo "PrivateInternetAccess OpenVPN Setup:"
echo " https://www.privateinternetaccess.com/pages/client-control-panel"
echo " -> PPTP/L2TP/SOCKS Username and Password"
echo -n "User: "
set user = $<
echo -n "Pass: "
set pass = $<
@mjdescy
mjdescy / DAOQueryRunner.cls
Created May 30, 2018 15:10
Microsoft Access VBA class to run queries via DAO
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "DAOQueryRunner"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Compare Database
@mjdescy
mjdescy / DAOTemporaryTableController.cls
Created May 30, 2018 15:18
Microsoft Access VBA class to create a temporary table and automatically delete it upon release
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "DAOTemporaryTableController"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Compare Database
@mjdescy
mjdescy / LoggedInUserName.bas
Last active May 30, 2018 15:42
VBA Module to Get Logged In User Name from Windows API
Attribute VB_Name = "LoggedInUserName"
Option Explicit
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function GetLoggedInUserName() As String
Dim MaxBufferLength As Long
MaxBufferLength = 255
@mjdescy
mjdescy / SemanticVersionNumber.swift
Created June 6, 2018 17:42
Semantic Version Number struct (Swift 4.1)
import Foundation
public struct SemanticVersionNumber: Equatable {
public let major: Int
public let minor: Int
public let patch: Int
public init?(version: String) {
let components = version.split(separator: ".")
guard components.count == 3 else { return nil }