This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using GetHashNs; //found in gethash.cs | |
namespace SnippetNamespace { | |
public class SnippetClass { | |
static void Main(string[] args){ | |
string p = "Bryan Miller"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Security.Cryptography; | |
using System.Diagnostics.CodeAnalysis; | |
namespace RandomNs | |
{ | |
public class CryptoRandom : Random | |
{ | |
private RNGCryptoServiceProvider _rng = new RNGCryptoServiceProvider(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()... | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Windows.Forms; | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Blog Entries Counter</title> | |
</head> | |
<body> | |
<?php | |
$path = realpath('fp-content/content'); | |
$regular_entries = 0; | |
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Example { | |
class Program { | |
static void Main(string[] args){ | |
string p = "This is a brief sample sentence."; | |
string[] words = p.Split(default(Char[]), StringSplitOptions.RemoveEmptyEntries); | |
Console.WriteLine(" The following sentence contains {0} words:", words.Length); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* shows how to get a string array holding the names of all top-level subdirectories | |
online at: | |
https://gist.github.com/kyrathasoft/1dc1a1eb4d6a2a56827dcb5f43840afe | |
To compile: csc *.cs | |
Here is the structure of this example program | |
and associated directories, on disk: |