Skip to content

Instantly share code, notes, and snippets.

// Now
app.MapGet("/todos/{id}", async (int id, TodoDb db) =>
await db.Todos.FindAsync(id)
is Todo todo
? Results.Ok(todo)
: Results.NotFound())
.WithName("GetTodoById")
.Produces<Todo>(StatusCodes.Status200OK)
.Produces(StatusCodes.Status404NotFound);
@danielroe
danielroe / settings.json
Last active April 19, 2025 06:36
VScode settings for a minimal UI
{
// Disable telemetry
"telemetry.telemetryLevel": "off",
// Zen mode
"zenMode.fullScreen": false,
"zenMode.hideTabs": true,
"zenMode.centerLayout": false,
// Theming
"workbench.iconTheme": "city-lights-icons-vsc",
"editor.fontFamily": "Dank Mono",
@ErikCH
ErikCH / App.vue
Created January 14, 2022 03:52
App.vue for Renderless Component Video
<script lang="ts" setup>
import FetchJson from "./components/fetch-json.vue";
// import { useFetch } from "@vueuse/core";
const url = "https://api.thecatapi.com/v1/images/search";
// const { isFetching: loading, error, data: response } = useFetch(url).json();
</script>
<template>
<h3>Random Cat Pics!</h3>
@olliencc
olliencc / DetectHardwareBreakPointMisuse.cpp
Last active January 17, 2025 15:00
Detect Windows processes with hardware breakpoints set
/*
Debug register (hardware breakpoint) misuse detector for Microsoft Windows
Released as open source by NCC Group Plc - http://www.nccgroup.com/
Developed by Ollie Whitehouse, ollie dot whitehouse at nccgroup dot com
Released under AGPL see LICENSE for more information
*/
@xoofx
xoofx / BenchWindowsTerminal.cs
Last active July 31, 2024 08:14
Bench Windows Terminal with a wall of 24-bits RGB ANSI scrolling chars
// Bench Windows Terminal with a wall of 24-bits RGB ANSI scrolling chars
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
var width = Console.WindowWidth;
var height = Console.WindowHeight;
var total = width * height;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
@MelbourneDeveloper
MelbourneDeveloper / TypelessGaphQL.cs
Last active February 5, 2022 04:50
Typeless GraphQL Select
using GraphQLParser;
using GraphQLParser.AST;
using Jayse;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Immutable;
namespace TypelessGraphQL;
/*
Functionality – when executed, these lines are copied to the clipboard:
1. The URL of the current web page.
2. The title of the current web page (as originally written)
3. The title of the current web page (converted to sentence case with a crude algorithm)
4. Optionally: The currently selected text (if any).
Installation: Create a bookmark whose URL is the code below (including `javascript:{···}`):
– Tested in Chrome and Safari.
– Both browsers can handle URLs with multiple lines.
@Neo23x0
Neo23x0 / log4j_rce_detection.md
Last active April 11, 2025 22:49
Log4j RCE CVE-2021-44228 Exploitation Detection

log4j RCE Exploitation Detection

You can use these commands and rules to search for exploitation attempts against log4j RCE vulnerability CVE-2021-44228

Grep / Zgrep

This command searches for exploitation attempts in uncompressed files in folder /var/log and all sub folders

sudo egrep -I -i -r '\$(\{|%7B)jndi:(ldap[s]?|rmi|dns|nis|iiop|corba|nds|http):/[^\n]+' /var/log
@MarkPflug
MarkPflug / QuickIntBench.cs
Created November 19, 2021 03:43
A SIMD integer parser.
using BenchmarkDotNet.Attributes;
using System;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
using System.Text;
namespace Benchmarks
{
public class QuickIntBench
{
<PropertyGroup Label="Output directory">
<BinariesFolder>$(SrcRoot)bin</BinariesFolder>
<CommonIntermediateOutputRoot>$(SrcRoot)obj\</CommonIntermediateOutputRoot>
<BaseIntermediateOutputPath>$(CommonIntermediateOutputRoot)$(Configuration)\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)</IntermediateOutputPath>
<AssemblyInfoPath Condition="'$(AssemblyInfoPath)' == ''">$(BaseIntermediateOutputPath)GlobalAssemblyInfo.cs</AssemblyInfoPath>
<CommonOutputDirectory>$(BinariesFolder)\$(Configuration)</CommonOutputDirectory>
<BuildToCommonOutputDirectory Condition="'$(BuildToCommonOutputDirectory)' == ''">true</BuildToCommonOutputDirectory>
<OutputPath Condition="'$(OutputPath)' == ''">$(BinariesFolder)\$(Configuration)\$(MSBuildProjectName)</OutputPath>
<OutputPath Condition="'$(BuildToCommonOutputDirectory)' == 'true'">$(CommonOutputDirectory)\</OutputPath>