Skip to content

Instantly share code, notes, and snippets.

One thing that surprises newer programmers is that the older 8-bit microcomputers from the 70s and 80s were designed to run at the speed of random memory access to DRAM and ROM. The C64 was released in 1982 when I was born and its 6502 CPU ran at 1 MHz (give or take depending on NTSC vs PAL). It had a 2-stage pipelined design that was designed to overlap execution and instruction fetch for the current and next instruction. Cycle counting was simple to understand and master since it was based almost entirely on the number of memory accesses (1 cycle each), with a 1-cycle penalty for taken branches because of the pipelined instruction fetch for the next sequential instruction. So, the entire architecture was based on keeping the memory subsystem busy 100% of the time by issuing a read or write every cycle. One-byte instructions with no memory operands like INX still take the minimum 2 cycles per instruction and end up redundantly issuing the same memory request two cycles in a row.

@motey
motey / gist:3028650e159d1e4e3bd30312aa822954
Created December 9, 2016 11:58
Musterbrief an Landgericht Hamburg bzgl. Beschluss vom 18. November (Az. 310 O 402/16)
https://www.heise.de/forum/heise-online/News-Kommentare/Gericht-bestaetigt-Haftung-fuer-Urheberrechtsverletzungen-auf-verlinkten-Seiten/Musterbrief/posting-29616440/show/
Sehr geehrte Damen und Herren,
gerne würde ich über ihren Beschluss vom 18. November (Az. 310 O 402/16) auf meiner Internetseite berichten. Im Rahmen der Berichterstattung möchte ich auch einen Link auf ihre Rechtsprechungsdatenbank hinterlegen, damit sich die Leser meines Berichts ein Bild über die Rechtsprechung ihres Hauses machen können.
Da ich nicht über Einsicht in alle ihre Vertragsangelegenheiten habe und somit nicht feststellen kann, ob für manche Medien auf ihrer Seite die Nutzungsrechte evtl. zeitlich beschränkt waren, komme ich auf diesem Wege meiner Pflicht zur Nachforschung nach und möchte mir von Ihnen als Seitenbetreiber eine Versicherung an Eides statt einholen, dass sie die entsprechenden Rechte zur Veröffentlichung haben.
Zur Vermeidung späterer Rechtsnachteile bitte ich hiermit im Sinne ihres o.g. Beschlusses um schri
@eiriktsarpalis
eiriktsarpalis / cont.fsx
Last active December 22, 2020 00:32
A Continuation monad with stacktrace support in F# 4.1
open System
open System.Runtime.CompilerServices
type SymbolicException =
{
Source : Exception
Stacktrace : string list
}
module SymbolicException =

When you set Let's Encrypt up, you will:

  • generate a key on your computer (among other things), which we will call domain.key
  • regularly update a certificate file via Let's Encrypt (most probably using one of the Acme Client Implementations), we will call this file domain.crt

The domain.key file is for your eyes only; you should keep it safe where you run taskd and set server.key to point to it.

@regisdiogo
regisdiogo / Startup.cs
Last active June 13, 2022 11:17
ASP.NET Core - Json serializer settings Enum as string and ignore null values
public class Startup
{
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddMvc().AddJsonOptions(options =>
{
options.SerializerSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter());
options.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
});
}
@indrayam
indrayam / create-jwt-using-unix-commands-on-mac.md
Last active September 21, 2022 08:08
Create JWT Token Header Using Unix Command line tools ONLY!

Pseudocode:

Y = Base64URLEncode(Header) + ‘.’ + Base64URLEncode(Payload)
JWT = Y + ‘.’ + Base64URLEncode(HMACSHA256(Y))

The steps called out here should work on a Mac as well. The only thing that might be different is the sed command used below. Instead of using -E, you will have to use -r to run sed with extended regular expression support

Use data from this tutorial:

scotch.io

@Overv
Overv / HelloTriangle.cc
Created April 24, 2016 18:54
Vulkan hello triangle
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <chrono>
#include <functional>
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
@davidfowl
davidfowl / Example1.cs
Last active March 28, 2024 20:36
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
@oaeide
oaeide / mountVHD.bat
Last active May 9, 2023 12:35
Script for mounting and unmounting VHD files in windows via send to menu
@ECHO OFF
TITLE Mount VHD
SETLOCAL
SET DiskPartScript="%TEMP%DiskpartScript.txt"
ECHO SELECT VDISK FILE="%~1" > %DiskPartScript%
ECHO ATTACH VDISK >> %DiskPartScript%