Skip to content

Instantly share code, notes, and snippets.

View PJensen's full-sized avatar

Pete Jensen PJensen

  • New England
View GitHub Profile
@PJensen
PJensen / FloatingPointEx.cs
Created April 22, 2013 14:05
Just a demonstration of IEEE floating point issue
var d = 0.0;
for (var i = 0; i < 100; i++)
{
d += 0.1;
d += 0.01;
d += 0.001;
d += 0.0001;
d += 0.00001;
d += 0.000001;
@PJensen
PJensen / SrcDestUpdate.sql
Created October 12, 2012 18:05
Updating a table using a source and destination table.
-- Updating a table using a source and destination table.
BEGIN TRAN
UPDATE [ToTable]
SET [ToTable].[Value] = [FromTable].[Value],
...
FROM [FromTable]
INNER JOIN [ToTable] ON ( /* Join Conditions */ )
WHERE ( /* Where Clause */ )
ROLLBACK TRAN
@PJensen
PJensen / FindDupesByHash.cs
Created August 17, 2012 01:33
Really quick hack to find duplicate files in a directory structure.
//
// FindDupesByHash.cs
//
// Author:
// pjensen <[email protected]>
//
// Description:
// Really quick hack to find duplicate files in a directory structure.
//
@PJensen
PJensen / FindDupes.cs
Last active April 8, 2021 17:38
Find duplicate files within directory structure.
//
// Main.cs
//
// Author:
// pjensen <[email protected]>
using System;
using System.Security.Cryptography;
using System.IO;
using System.Collections.Generic;
@PJensen
PJensen / IsSubset.cs
Created July 19, 2012 21:04
IsSubset
static bool IsSubset(int[] a, int[] b)
{
var a1 = new List<int>(a);
var b1 = new List<int>(b);
foreach (var k in a1)
{
b1.Remove(k);
}
@PJensen
PJensen / employment.py
Created March 9, 2012 19:31
Explores the 99w rollover period and it's effect on charts.
import time,random
ROLLOVER_WKS = 99
YEARS = 5
employmentData = []
for i in range(0,YEARS*52):
employmentData.append(random.randint(-100,100))
if (i > ROLLOVER_WKS):
@PJensen
PJensen / ServiceReference.asp
Created October 28, 2011 16:49
Perform basic authentication using classic ASP
<%
'-- ********************************************************************************
'-- Class: ServiceReference
'-- Description: This class is used to make a web service requests.
'--
'-- Remarks:
'--
'-- http://www.soapui.org/ has an *excellent* tool for crafting various web methods
'-- (1) Download and install SOAPui
'--- (2) Create a new project, when prompted for a WSDL enter
@PJensen
PJensen / sym.c
Created August 17, 2011 21:42
symbols
typedef unsigned long ID;
@PJensen
PJensen / a.nasm
Created July 26, 2011 21:45
joelgompert.com OS tutorial
mov ax, 0x07C0 ; set up segments
mov ds, ax
mov es, ax
mov si, welcome
call print_string
loop:
mov al, 0x13
@PJensen
PJensen / Scruit.py
Created July 7, 2011 16:46
The Scruit compiler.
import os, sys, string, random
COMPILER_ERRORS = """
Cannot have multiple default property/method in a Class
Cannot use parentheses when calling a Sub
Class initialize or terminate do not have arguments
'Default' specification can only be on Property Get
'Default' specification must also specify 'Public'
Expected '('
Expected ')'