Skip to content

Instantly share code, notes, and snippets.

@devhawk
devhawk / looking for the mouse.md
Created February 5, 2024 15:10 — forked from jm3/looking for the mouse.md
Gin, Television, and Social Surplus

Gin, Television, and Social Surplus, or, “Looking for the Mouse”

Clay Shirky / April 26, 2008

transcription of a speech [Clay Shirky] gave at the Web 2.0 in 2008, emphasis by @jm3

I was recently reminded of some reading I did in college, way back in the last century, by a British historian arguing that the critical technology, for the early phase of the industrial revolution, was gin.

The transformation from rural to urban life was so sudden, and so wrenching, that the only thing society could do to manage was to drink itself into a stupor for a generation. The stories from that era are amazing-- there were gin pushcarts working their way through the streets of London.

And it wasn't until society woke up from that collective bender that we actually started to get the institutional structures that we associate with the industrial revolution today. Things like public libraries and museums, increasingly broad education for children, elected leaders--a lot of th

static int GetLength(ReadOnlyMemory<char> base64)
{
if (base64.IsEmpty) return 0;
var characterCount = base64.Length;
var paddingCount = 0;
if (base64.Span[characterCount - 1] == '=') paddingCount++;
if (base64.Span[characterCount - 2] == '=') paddingCount++;
return (3 * (characterCount / 4)) - paddingCount;
@devhawk
devhawk / output.json
Created December 15, 2021 18:50
Neo Test Runner Sample Output
// > Executing task: dotnet neo-test-runner ./invoke-files/register-sample-domain.neo-invoke.json --checkpoint ./checkpoints/contract-deployed.neoxp-checkpoint --account bob --express ./default.neo-express --storages registrar --nef-file ./src/bin/sc/registrar.nef
{
"state": "HALT",
"exception": null,
"gasconsumed": "0.0869496",
"logs": [],
"notifications": [],
"stack": [
{
using Neo;
using Neo.SmartContract.Framework;
using Neo.SmartContract.Framework.Services;
namespace DevHawk
{
public class TestContract : SmartContract
{
StorageMap domains = new StorageMap(Storage.CurrentContext, nameof(domains));
internal unsafe static void AppendUnmanged<T>(this IncrementalHash hasher, in T item) where T : unmanaged
{
fixed (T* ptr = &item)
{
hasher.AppendData(MemoryMarshal.AsBytes(new ReadOnlySpan<T>(ptr, 1)));
}
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using Neo;
using Neo.Cryptography.ECC;
@devhawk
devhawk / winX-powershell-core.ps1
Created May 14, 2020 18:13
Update the start menu Windows PowerShell.lnk to point to PowerShell Core
$pwsh = get-command pwsh -ErrorAction SilentlyContinue
if (-not $pwsh) {
write-error "cannot locate pwsh, exiting"
break
}
$psLinkPath = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows PowerShell.lnk"
$WshShell = New-Object -ComObject WScript.Shell
$psLink = $WshShell.CreateShortcut($psLinkPath)
Write-Output $psLink.TargetPath
@devhawk
devhawk / keybase.md
Created April 21, 2020 22:22
keybase.md

Keybase proof

I hereby claim:

  • I am devhawk on github.
  • I am devhawk (https://keybase.io/devhawk) on keybase.
  • I have a public key ASAw8V89tsBo90LPFK3CEtaIIKKvO7kAZDIKBTHEW_h1Ugo

To claim this, I am signing this object:

@devhawk
devhawk / aProgram.cs
Last active February 29, 2020 00:20
DumpAvm
using System;
using System.Collections.Generic;
using System.IO;
namespace DumpAvm
{
readonly struct Instruction
{
public readonly AvmOpCodes OpCode;
public readonly ReadOnlyMemory<byte> Operand;