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
@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]
);
<?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
select X = X.n
, [Circle] = [Circle].n
, [DxCircle] = X.n / NullIf(2. * Abs(X.n), 0)
, [Rectangle] = [Rectangle].n
, [Dx Rectangle] = 1. / Sqrt(4 * X.n + 1)
, [Square] = [Square].n
, [Dx Square] = 1. / NullIf(2. * Sqrt(X.n), 0)
, [Triangle] = [Triangle].n
, [Dx Triangle] = 2. / Sqrt(8 * X.n + 1)
, [Square Triangle] = [Square Triangle].n
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
COMMENT @
C Interface:
extern char* Rfc4180_ReadRow(const char* bufferOffset, const char* bufferTail, long long isQuotedSequence);
Reference:
https://tools.ietf.org/html/rfc4180
@
;-----------------------------; (CONSTANTS)
CARRIAGE_RETURN = 00Dh