Skip to content

Instantly share code, notes, and snippets.

View pmachapman's full-sized avatar

Peter Chapman pmachapman

View GitHub Profile
@pmachapman
pmachapman / VB6Compatibility.bas
Created December 7, 2016 06:51
Visual Basic 6 Compatibility Routines
Attribute VB_Name = "VB6Compatibility"
Option Explicit
Public Const vbTextCompare = 1
Public Const vbBinaryCompare = 0
Public Function Join(source() As String, Optional sDelim) As String
Dim sOut As String, iC As Integer
If IsMissing(sDelim) Then
sDelim = " "
@pmachapman
pmachapman / kiosk.py
Created November 3, 2016 03:06
Raspberry Pi Video Kiosk Program
import RPi.GPIO as GPIO
import time
import os
import atexit
# Setup exit handler
def exit_handler():
# Reset cursor
os.system("setterm -cursor on")
atexit.register(exit_handler)
@pmachapman
pmachapman / msbin.c
Created September 26, 2016 07:24
Microsoft Binary Data Format Functions
//
// The following are implementations of Microsoft RTL functions not
// include in the Borland RTL.
//
// Functions:
// _fmsbintoieee()
// _fieeetomsbin()
// _dmsbintoieee()
// _dieeetomsbin()
//
@pmachapman
pmachapman / addressof.bas
Created July 25, 2016 02:54
AddressOf for Visual Basic 4.0
Attribute VB_Name = "AddressOf"
Option Explicit
' This module is only needed in VB4. The functions
' are used to get the addresses of variables as you
' would with AddressOf in VB5 or higher.
' If you use this, you need to call AllocAsmCode at
' the beginning of your program and check the return
' value. Only continue the program if it returns
' True. Also call FreeAsmCode before your program
@pmachapman
pmachapman / ports.bat
Created May 1, 2016 01:00
Query the registry for available serial ports
@echo off
rem Queries the registry for available serial ports
rem From Silicon Chip Magazine November 2015
reg query HKLM\hardware\devicemap\serialcomm
pause
// file: play2wav.c
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#ifndef M_PI
#define M_PI 3.14159265358
#endif
@pmachapman
pmachapman / tinybasic.c
Created March 23, 2016 09:54
A tiny BASIC Interpreter
/* A tiny BASIC interpreter */
#include <string.h>
#include <stdio.h>
#include <setjmp.h>
#include <math.h>
#include <ctype.h>
#include <stdlib.h>
#define NUM_LAB 100
@pmachapman
pmachapman / SBasic.java
Created March 23, 2016 07:12
Small Basic Interpreter from Herbert Schildt's The Art of Java
// A Small Basic Interpreter.
import java.io.*;
import java.util.*;
// Exception class for interpreter errors.
class InterpreterException extends Exception {
String errStr; // describes the error
public InterpreterException(String str) {
@pmachapman
pmachapman / .bashrc
Created February 7, 2016 02:16
.bashrc
# .bashrc
# User specific aliases and functions
alias cp='cp -i'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias news=slrn
@pmachapman
pmachapman / Disable Zip File Searching.bat
Created January 8, 2016 01:36
Remove zip file searching from Windows XP
@echo off
rem Remove zip file searching from Windows XP
rem By Peter Chapman <peter@conglomo.co.nz>
echo Before continuing be sure to have zip files associated with another program
pause
echo.
echo Unregistering ZIP Folder DLL
regsvr32 /u /s zipfldr.dll
echo Unregistering Cabinet Viewer DLL
regsvr32 /u /s cabview.dll