Skip to content

Instantly share code, notes, and snippets.

View PatrickMcDonald's full-sized avatar

Patrick McDonald PatrickMcDonald

View GitHub Profile
@PatrickMcDonald
PatrickMcDonald / CustomException.vb
Created May 23, 2012 15:02
A basic sub-class of System.Exception that passes FxCop (VB.NET)
Imports System.Runtime.Serialization
<Serializable()>
Public Class CustomException
Inherits Exception
Public Sub New()
MyBase.New()
End Sub
@PatrickMcDonald
PatrickMcDonald / log4net.config
Last active October 7, 2015 14:57
Basic RollingFileAppender log4net configuration
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<!-- Setup a rolling file appender -->
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="..\filename.log" />
<appendToFile value="true" />
Dim catalog As Object
Set catalog = CreateObject("COMAdmin.COMAdminCatalog")
Dim applicationName As String
applicationName = "Individual Projections"
' stop app
catalog.ShutdownApplication applicationName
' start app
@PatrickMcDonald
PatrickMcDonald / WorldBank XmlHelpers
Created July 19, 2013 10:28
From examples in Real World Functional Programming
module XmlHelpers
open System.Xml.Linq
let wb = "http://www.worldbank.org"
let xattr s (el:XElement) =
el.Attribute(XName.Get(s)).Value
let xelem s (el:XContainer) =
@PatrickMcDonald
PatrickMcDonald / reg.bat
Created July 30, 2013 10:56
Modify registry from command-line
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\SystemCore\VSCore\On Access Scanner\McShield\Configuration\Default" /v "ScanArchives" /t REG_DWORD /d 0
@PatrickMcDonald
PatrickMcDonald / Clean VB6.bat
Created July 30, 2013 16:23
Clean all vbw, exp and lib files recursively
@echo off
attrib -r *.lib /s > nul 2>&1
attrib -r *.exp /s > nul 2>&1
attrib -r *.vbw /s > nul 2>&1
del *.lib /s 2>nul
del *.exp /s 2>nul
del *.vbw /s 2>nul
namespace PostFix
{
internal class Program
{
private static void Main(string[] args)
{
int i = 1;
F(i++, i); // 1,2
int j = 1;
'Enable Registry Editing'
'© Veegertx - 4/7/2004
'This code may be freely distributed/modified
On Error Resume Next
'Prevents errors from values that don't exist
Set WshShell = WScript.CreateObject("WScript.Shell")
'Delete DisableRegistryTools registry values
WshShell.RegDelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableRegistryTools"
WshShell.RegDelete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\DisableRegistryTools"
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\dllfile\shell\register]
@="Register"
[HKEY_CLASSES_ROOT\dllfile\shell\register\command]
@="\"c:\\windows\\system32\\regsvr32.exe\" \"%1\""
[HKEY_CLASSES_ROOT\dllfile\shell\unregister]
@="Unregister"
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\exefile\shell\register]
@="Register ActiveX"
[HKEY_CLASSES_ROOT\exefile\shell\register\command]
@="\"%1\" /regserver"
[HKEY_CLASSES_ROOT\exefile\shell\unregister]
@="Unregister ActiveX"