Skip to content

Instantly share code, notes, and snippets.

View Kittoes0124's full-sized avatar
🏠
Working from home

David Smith Kittoes0124

🏠
Working from home
View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="HTTP to HTTPS Redirect" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{SERVER_NAME}" pattern="^localhost$" negate="true" />
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
create function dbo.GenerateMergeProcedure (
@sourceTableName nvarchar(260)
, @targetTableName nvarchar(260)
, @keyColumnName nvarchar(130)
, @storedProcedureName nvarchar(260)
)
returns nvarchar(max)
as
begin;
declare @columns table (
using System;
using System.Text;
namespace ByteTerrace.CSharp.Data
{
public struct AsciiString : IEquatable<AsciiString>
{
private readonly byte[] m_data;
private readonly uint m_length;
private readonly uint m_offset;
A048597 "Very round numbers: reduced residue system consists of only primes and 1."
- finite (10)
- 1, 2, 3, 4, 6, 8, 12, 18, 24, 30
A000040 "The prime numbers."
- infinite
- 2, 3, 5, 7, 11, 13, 17, 19, 23, 29...
30:
- becomes 8 when passed through Euler's Totient Function
@Kittoes0124
Kittoes0124 / NthWeekday.sql
Last active September 22, 2017 19:27
Calculates the nth weekday from a given start date.
create function [dbo].[NthWeekday] (
@startDate date
, @n int = 0
, @weekday int = 0 -- SUNDAY
)
returns table
with schemabinding
as return (
select DateAdd(day, -((DatePart(weekday, @startDate) + @@DateFirst - 1) % 7) + (@weekday % 7) + (7 * @n), @startDate) as [Value]
);
public class BinaryHeap<T>
{
private readonly IComparer<T> m_comparer;
private readonly IList<T> m_values;
private int m_offset;
public int Capacity => m_values.Count;
public int Count => m_offset;
.code
Main proc
sub rsp, 28h ; align with 16 while simultaneously setting up the "home space"
; TODO: something useful here...
xor eax, eax ; set return value to zero
add rsp, 48h ; free all space that was reserved on the stack
ret ; end of main
Main endp
end
COMMENT @
https://agner.org/optimize/instruction_tables.pdf
https://agner.org/optimize/microarchitecture.pdf
https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-createfilew
https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfilesizeex
https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-readfile
https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-writefile
https://docs.microsoft.com/en-us/windows/desktop/api/handleapi/nf-handleapi-closehandle
https://docs.microsoft.com/en-us/windows/desktop/api/memoryapi/nf-memoryapi-createfilemappingw
https://docs.microsoft.com/en-us/windows/desktop/api/memoryapi/nf-memoryapi-mapviewoffileex
public sealed class Die
{
private readonly int m_numberOfSides;
private readonly IRandomNumberGenerator m_rng;
public Die(int numberOfSides, IRandomNumberGenerator rng) {
if (0 > numberOfSides) {
throw new ArgumentOutOfRangeException(actualValue: numberOfSides, message: "value must be greater than zero", paramName: nameof(numberOfSides));
}
using System;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Security;
namespace ByteTerrace.Windows.Api
{
static class BitwiseHelpers
{
public static uint ConcatBits(ushort highPart, ushort lowPart) => ((((uint)highPart) << 16) | lowPart);