Skip to content

Instantly share code, notes, and snippets.

View marcusholmgren's full-sized avatar

Marcus Holmgren marcusholmgren

View GitHub Profile
@marcusholmgren
marcusholmgren / guess_the_number_py
Created April 5, 2020 15:23
Simple game where you guess a random number between 1 - 25
#!/usr/bin/env python3
# Guess the Number
# 1. Ask the user how many times they would like to play
# 2. For every game, ask the player to select a random number between 1 - 25
# 3. Inform the player if the number is higher or lower
# 4. Build a loop statement that will iterate number of games and numbers picked
# 5. When user guess correct, tell them how many guesses it took
@marcusholmgren
marcusholmgren / logon_event_trigger.sql
Created February 25, 2020 19:51
Trigger firing when users log on to the server
-- Create a trigger firing when users log on to the server
CREATE TRIGGER LogonAudit
-- Use ALL SERVER to create a server-level trigger
ON ALL SERVER WITH EXECUTE AS 'sa'
-- The trigger should fire after a logon
AFTER LOGON
AS
-- Save user details in the audit table
INSERT INTO ServerLogonLog (LoginName, LoginDate, SessionID, SourceIPAddress)
SELECT ORIGINAL_LOGIN(), GETDATE(), @@SPID, client_net_address
@marcusholmgren
marcusholmgren / .gitconfig
Created January 1, 2017 14:47
git configuration
[user]
name = <name>
email = <name>@gmail.com
[color]
ui = auto
[filter "media"]
required = true
clean = git media clean %f
smudge = git media smudge %f
[alias]
@marcusholmgren
marcusholmgren / Program.cs
Created November 29, 2012 06:01
Ayende's modern version of the AbstractFactory
/*
* thanks to Ayende for idea, http://tekpub.com/shows/mct/1
*/
using System;
namespace AbstactFactory
{
class Program
{
public static void Main()
@marcusholmgren
marcusholmgren / mstestcleanup.py
Created March 16, 2012 05:34
IronPython script that deletes files generated from MSTest results
__author__ = "Marcus Holmgren"
import sys
import clr
clr.AddReference('System')
from System import (Console, ConsoleColor, Exception)
from System.IO import (Directory, File, FileInfo, FileAttributes, SearchOption)
@marcusholmgren
marcusholmgren / CSharp-Mode.xshd
Created January 21, 2010 19:02
VibrantInk inspired syntax highligthing for C# in SharpDevelop
<?xml version="1.0" encoding="utf-8"?>
<!--This file was autogenerated by the #Develop highlighting editor.-->
<!--VibrantInk inspired syntax highligthing for C# in #Develop.-->
<SyntaxDefinition name="C#" extensions=".cs">
<Environment>
<Custom name="TypeReference" bold="false" italic="false" color="Pink" />
<Custom name="UnknownEntity" bold="false" italic="false" color="Yellow" />
<Default bold="false" italic="false" color="White" bgcolor="Black" />
<Selection bold="false" italic="false" color="White" bgcolor="#6897BB" />
<VRuler bold="false" italic="false" color="Pink" bgcolor="#E3E3E3" />