Skip to content

Instantly share code, notes, and snippets.

roughconsensusandrunningcode / spamcausedecoder.cs
Last active May 13, 2024 16:58
C# - Decode a X-VR-SPAMCAUSE mail header
using System;
public class Program
/// <summary>
/// Decode a X-VR-SPAMCAUSE mail header
/// </summary>
/// <param name="encodedSpamcause">The X-VR-SPAMCAUSE content to decode</param>
/// <returns>The decoded spam cause</returns>
public static string Decode(string encodedSpamcause)
roughconsensusandrunningcode / PasswordGenerator.js
Last active October 27, 2023 08:21
JavaScript - Password generator based on crypto.getRandomValues()
class PasswordGenerator {
#chunksFromString(string, chunkSize) {
const numChunks = Math.floor(string.length / chunkSize);
const chunks = new Array(numChunks);
for (let i=0, o=0; i < numChunks; ++i, o+=chunkSize) {
chunks[i] = string.substr(o, chunkSize);
return chunks;
roughconsensusandrunningcode / TooManyRequestsObjectResult.cs
Last active May 15, 2023 14:03
C# - An ObjectResult that when executed will produce a Too Many Requests (429) response with an optional Retry-After header.
namespace Microsoft.AspNetCore.Mvc;
/// <summary>
/// An <see cref="ObjectResult"/> that when executed will produce
/// a <see cref="StatusCodes.Status429TooManyRequests"/> response
/// with an optional Retry-After header.
/// </summary>
public class TooManyRequestsObjectResult : ObjectResult
roughconsensusandrunningcode / writeandhash.cs
Last active January 3, 2020 23:11
C# - Create a file and compute its hash at the same time
using System;
using System.IO;
using System.Security.Cryptography;
namespace HashDemo
class Program
public static void Main (string[] args)
roughconsensusandrunningcode / errors.csv
Last active May 15, 2023 14:32
Elenco delle stazioni ferroviarie italiane in formato CSV e GeoJSON
Name Id StatusCode
ACQUAMELA S09798 NoContent
AGOGNATE S00075 NoContent
AIELLI S08550 NoContent
ALBERGO S06067 NoContent
ALIFE S09020 NoContent
ALVIGNNO S09023 NoContent
ANCONA STADIO S07114 NoContent
ANDORA S04525 NoContent