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

@devhawk
devhawk / vsdevcmd.yml
Last active November 1, 2023 21:42
Locate vsdevcmd in azure pipelines
parameters:
buildArchitecture: 'x86' # defaults for any parameters that aren't specified
hostArchitecture: 'x86'
steps:
- script: |
@echo off
set vswherepath="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
for /f "usebackq delims=" %%i in (`%vswherepath% -latest -property installationPath`) do (
id title author status
DN00
The Design Note Process
hpierson@hotmail.com
draft

DN00 - The Design Note Process

@devhawk
devhawk / WinRtAwaiter.cs
Last active January 13, 2023 08:55
Simple C# class to add async/await support for WinRT async operations w/o System.Runtime.WindowsRuntime.
using System.Runtime.CompilerServices;
using Windows.Foundation;
static class WinRtHelper
{
struct VoidValueTypeParameter { }
public static TaskAwaiter GetAwaiter(this IAsyncAction op)
{
var tcs = new TaskCompletionSource<VoidValueTypeParameter>();
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": [
{
@devhawk
devhawk / colorconsole.fs
Created August 4, 2016 17:19
F# Color Console Functions
open System
// helper function to set the console collor and automatically set it back when disposed
let consoleColor (fc : ConsoleColor) =
let current = Console.ForegroundColor
Console.ForegroundColor <- fc
{ new IDisposable with
member x.Dispose() = Console.ForegroundColor <- current }
// printf statements that allow user to specify output color
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;