Skip to content

Instantly share code, notes, and snippets.


William.Miller kyrathasoft

View GitHub Profile
kyrathasoft / pubconst.cs
Created Aug 14, 2022
declaring public constants
View pubconst.cs
using System;
namespace EarthApotheosis {
public class EarthApotheosisConstants
public static string TITLE = Properties.Resources.Title;
public const int KILLS_TO_EARN_ONE_COMBAT_ADV_POINT = 50;
public const int MAX_CHARS_PER_LINE_IN_LABEL_DISPLAY = 80;
public const string INPUT_CURRENTLY_DISABLED = "Input currently disabled...";
kyrathasoft / gist:e1458d0650c494eb448b5aa703f5d752
Created Aug 14, 2022
VbScript to archive directory or extract an archive
View gist:e1458d0650c494eb448b5aa703f5d752
Function QuickZip(path)
'@description: Compress and uncompress zip files.
'@author: Jeremy England (SimplyCoded)
Dim oFso : Set oFso = CreateObject("Scripting.FileSystemObject")
Dim oSap : Set oSap = CreateObject("Shell.Application")
Dim oWss : Set oWss = CreateObject("WScript.Shell")
Dim isZip, count, root, base, add, out
Dim isZipping, isCancelable
Const NOT_FOUND = 1
Const NOT_A_ZIP = 2
kyrathasoft / naudio.cs
Created Aug 8, 2022
Use NAudio to play .wav or .mp3 files
View naudio.cs
using System;
using NAudio;
using NAudio.Wave;
namespace PlayMp3{
class Program {
static void Main(string[] args)
kyrathasoft / lnchCap.cs
Last active Aug 12, 2022
Launch process and capture output
View lnchCap.cs
===== Capturing Output From A Console Process =====
This example program relies upon hello_world.exe being in the same directory as this source code's
compiled output, which is directory C:\Users\kyrat\Dropbox\csdev\examples\ as of 12 Aug 2022
using System;
using System.Diagnostics;
kyrathasoft / gethash.cs
Last active May 18, 2021
Library for returning SHA1 and MD5 hashes
View gethash.cs
/* This code was copied by Bryan Miller 16th May 2021, but the actual prime detection
methods contain code found on various websites and forums. */
using System;
using System.Security.Cryptography;
using System.Text;
namespace GetHashNs {
public class GetHashCls {
View gist:bfc7a7336fe217d4c0f55cd1134820aa
using System;
using GetHashNs; //found in gethash.cs
namespace SnippetNamespace {
public class SnippetClass {
static void Main(string[] args){
string p = "Bryan Miller";
kyrathasoft / prime.cs
Created May 16, 2021
an efficient method for detecting if a positive integer is a prime number
View prime.cs
/* This code written by Bryan Miller 9th May 2021, but the actual prime detection
methods contain code found on various websites and forums.
To create DLL prime.dll, csc /t:library prime.cs
To build EXE myprogram.exe referencing that DLL, csc /r:prime.dll myprogram.cs */
using System;
namespace IsPrimeNs {
kyrathasoft / cryptorandom.cs
Last active May 16, 2021
use this for random number generation
View cryptorandom.cs
using System;
using System.Security.Cryptography;
using System.Diagnostics.CodeAnalysis;
namespace RandomNs
public class CryptoRandom : Random
private RNGCryptoServiceProvider _rng = new RNGCryptoServiceProvider();
kyrathasoft / hashing methods
Created Nov 9, 2019
computer SHA1 and MD5 hashes of strings
View hashing methods
//requires using System.Security.Cryptography;
static string GetSHA1 (string ipString) {
SHA1 sha1 = new SHA1CryptoServiceProvider ();
byte[] ipBytes = Encoding.Default.GetBytes (ipString.ToCharArray ());
byte[] opBytes = sha1.ComputeHash (ipBytes);
StringBuilder stringBuilder = new StringBuilder (40);
for (int i = 0; i < opBytes.Length; i++) {
stringBuilder.Append (opBytes[i].ToString ("x2"));
kyrathasoft / moveFormWithoutTitlebar.cs
Created Nov 9, 2019
Move a form using MouseDown() even if it doesn't have a titlebar
View moveFormWithoutTitlebar.cs
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
Shows how to move the form without using a Title Bar to drag the form around the screen.
This can be adapted for custom forms (those with a customized picture box image overlaying the form,
and FormBorderstyle set to 'None' by simply changing Form1_MouseDown() to pictureBox1_MouseDown()...