var app = WebApplication.Create(args);
app.MapGet("/", () => "Hello World");
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Post: https://x.com/VictorTaelin/status/1854326873590792276 | |
// Note: The atomics must be kept. | |
// Note: This will segfault on non-Apple devices due to upfront mallocs.#include <stdint.h> | |
#include <stdint.h> | |
#include <stdatomic.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# rename-pictures.sh | |
# Author: Justine Tunney <[email protected]> | |
# License: Apache 2.0 | |
# | |
# This shell script can be used to ensure all the images in a folder | |
# have good descriptive filenames that are written in English. It's | |
# based on the Mistral 7b and LLaVA v1.5 models. | |
# | |
# For example, the following command: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
var list1 = new FixedList<string, Buffer16<string>>(); | |
var list2 = new FixedList<string, Buffer32<string>>(); | |
UseList(ref list1, "Hello"); | |
UseList(ref list2, "World"); | |
Console.WriteLine(list1.GetRef(0)); | |
Console.WriteLine(list2.GetRef(0)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
var list1 = new FixedList16<int>(); | |
var list2 = new FixedList32<int>(); | |
UseList(ref list1, 1); | |
UseList(ref list2, 2); | |
static void UseList<TItem, TList>(ref TList list, TItem item) | |
where TItem : unmanaged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
using System.Runtime.Intrinsics; | |
namespace CSharpLib; | |
public class CSharpBench | |
{ | |
[MethodImpl(MethodImplOptions.AggressiveInlining)] | |
public static int[] CSharp_Bench2(int[] a, int[] b, int[] result, int size) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
More recent resolution: | |
1. cd ~/../../etc (go to etc folder in WSL). | |
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line). | |
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line). | |
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian). | |
5. cd ~/../../etc (go to etc folder in WSL). | |
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file). | |
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and | |
secondary. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![allow(unused)] | |
fn main() { | |
use std::mem::{self, MaybeUninit}; | |
let data = { | |
// Create an uninitialized array of `MaybeUninit`. The `assume_init` is | |
// safe because the type we are claiming to have initialized here is a | |
// bunch of `MaybeUninit`s, which do not require initialization. | |
let mut data: [MaybeUninit<Vec<u32>>; 1000] = unsafe { | |
MaybeUninit::uninit().assume_init() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object obj; | |
var r = 0; | |
const int cnt = 1000000; | |
var constructorInfo = typeof(Class).GetConstructor(new[] { typeof(int) })!; | |
var hCtor = constructorInfo.MethodHandle; | |
RuntimeHelpers.PrepareMethod(RuntimeMethodHandle.FromIntPtr(hCtor.Value)); | |
var pCtor = (delegate* managed<object, int, void>)hCtor.GetFunctionPointer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.IO.Pipelines; | |
using System.Net; | |
using System.Net.Security; | |
using Microsoft.AspNetCore.Connections; | |
using Microsoft.AspNetCore.Connections.Features; | |
using Microsoft.AspNetCore.Http.Features; | |
using Microsoft.AspNetCore.Server.Kestrel.Core; | |
var builder = WebApplication.CreateBuilder(args); |
NewerOlder