Skip to content

Instantly share code, notes, and snippets.

@rnelson
rnelson / SMBDIS.ASM
Created December 31, 2024 20:59 — forked from 1wErt3r/SMBDIS.ASM
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger ([email protected])
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
@rnelson
rnelson / answer.c
Last active December 24, 2024 18:37
take_magic_damage
int take_magic_damage(int health, int resist, int amp, int spell_power) {
int full_damage = spell_power * amp;
int damage_taken = full_damage - resist;
return health - damage_taken;
}
@rnelson
rnelson / Program.cs
Created July 1, 2024 18:00
Rendezvous.FruitStand
// Kept the example run as-is, with the following exceptions:
// 1. Changed "let" to "var"
// 2. Added "new" on line 7
// 3. Added semicolons to the statements
// Create a new fruit stand
var stand = new FruitStand();
// Add fruits to the stand
stand.addFruit("apple", 10, 0.5);
@rnelson
rnelson / Program.cs
Created June 3, 2024 15:45
Rendezvous.OnlyEvens
using System.Text;
IEnumerable<int> onlyEvens(IEnumerable<int> list) => list.Where(i => i % 2 == 0).OrderBy(i => i);
void Dump(IEnumerable<int> list)
{
var sb = new StringBuilder();
sb.Append("[");
sb.Append(string.Join(", ", list.Select(i => i.ToString())));
sb.Append("]");
@rnelson
rnelson / Program.cs
Created May 21, 2024 00:04
Simple .NET 8 console app that sends a single tweet
using System.Text.Json;
using TwitterApiLibrary;
using TwitterApiLibrary.OAuth;
/*
* Credentials
* -----------
* 1. Go to the Twitter Developer Portal and create a new application.
* 2. Edit the User authentication settings
* App permissions: Read and write
@rnelson
rnelson / dotnet-on-freebsd.md
Last active November 4, 2023 15:11
.NET 7 on FreeBSD 13.2

.NET 7 on FreeBSD 13.2

After getting it up and running, I sent a quick toot about having .NET 7 running on my FreeBSD VM. It got a lot of boosts and favorites.

To make the process easier for others and to make sure credit is given where due, I decided to make this little gist.

Credits

I did nothing here but find the right bits of instructions and follow them. It looks like Thefrank and sec are the driving forces behind getting .NET working on FreeBSD. More information is on the FreeBSD wiki's .NET page.

@rnelson
rnelson / FileNotFoundException.md
Created January 27, 2022 01:37
Genesyslab.Sip.Endpoint.Provider.Genesys.dll + FileNotFoundException

FileNotFoundException

A few months back, I wrote a simple little Windows desktop application using WPF. It's built for .NET Framework 4.5, which means it should run in 4.5 through 4.8 without any issues. Outside of some core .NET assemblies and the WPF ones, it has a whopping three dependencies:

  1. Genesyslab.Sip.Endpoint.dll
  2. Genesyslab.Sip.Endpoint.Provider.Genesys.dll
  3. Newtonsoft.Json.dll

This application has been used internally on my network, internally on the other half of the company's network (we had a big merger, the networks are linked but only enough to get the important things working on both sides), and internally on some vendor networks. At launch, it connects to a web service of mine to pull down configuration stuff, and user-selected options then dictate what Genesys servers those first two dependencies connect to. Nice and simple.

@rnelson
rnelson / sameDigits.linq
Created May 10, 2021 23:35
sameDigits()
<Query Kind="Program" />
void Main()
{
sameDigits(1);
sameDigits(10);
sameDigits(251894);
sameDigits(251895);
}
#!/bin/ksh
# Cobbled together using https://www.romanzolotarev.com/random.html
# and https://docstore.mik.ua/orelly/unix3/korn/appb_11.htm
CHARS=' -~'
SIZE=20
USAGE="as#"
while getopts "$USAGE" opt; do