Skip to content

Instantly share code, notes, and snippets.

View the file when you run "notepad $PROFILE"
set-alias -name npp -value "${env:ProgramFiles}\Notepad++\notepad++.exe"
set-alias -name ed -value "code"
remove-item alias:curl -EA SilentlyContinue
$DefaultUser = 'hyrma'
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
hyrmn / hello.zig
Created Jan 27, 2020
Reading a file and counting carriage returns in Zig 0.5.x+master
View hello.zig
const std = @import("std");
const os = std.os;
const fs = std.fs;
const File = std.fs.File;
pub fn main() !void {
const stdout = &;
//try stdout.print("Hello, {}!\n", .{"world"});
var file = try fs.openFileAbsolute("c:\\data\\bigsum.txt", File.OpenFlags{});
defer file.close();
hyrmn / netcore linecount
Created Jan 21, 2020
netcore 3.1. hardcoded to the location of a 1.6gb text file
View netcore linecount
class Program
static void Main(string[] args)
var count = 0;
using var reader = File.OpenText(@"C:\code\go\src\\hyrmn\lc\pkg\lc\testdata\bigsum.txt");
var buffer = new Span<char>(new char[1024]);
int readLength;
View gitconfig
name = Ben Hyrman
email =
autocrlf = true
editor = vim
excludesfile = C:\\Users\\B.Hyrman\\Documents\\gitignore_global.txt
helper = manager
View files.cs
public class PartitionedNamingStrategy
private static readonly Dictionary<string, Func<string, string>> NamingStrategies = new Dictionary<string, Func<string, string>>
{"none", s => s},
{"bymachine", s => $"{Environment.MachineName}_{s}"}
private readonly string _strategy;
hyrmn / main.cs
Created Oct 29, 2019
Two simple local functions
View main.cs
static decimal CalculateBalance(AccountId accountId)
//assume these things come in externally
var charges = new[] {new Charge(100M)};
var payments = new[] {new Payment(20M)};
var chargeBalance = Σ(charges.Select(c => c.Amount));
var paymentCredit = Σ(payments.Select(p => p.Amount));
return chargeBalance - paymentCredit;
hyrmn / dbmigrator.csproj
Created Oct 18, 2019
refuses to pick up new files unless I clean or delete bin/obj first
View dbmigrator.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PackageReference Include="DbUp-SqlServer" Version="4.2.0" />
<PackageReference Include="OctoPack" Version="3.0.31" />
hyrmn / capslockwarning.js
Created Oct 4, 2019
Show a little capslock warning if the user tries to log in while their capslock key is on.
View capslockwarning.js
(function() {
var capsLockEnabled = false;
document.onkeypress = function (e) {
e = e || window.event;
var s = String.fromCharCode(e.keyCode || e.which);
if (s.toLowerCase() === s.toUpperCase()) {
View BenchmarkDotNetStringOptions.cs
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following: