Skip to content

Instantly share code, notes, and snippets.

View 0xced's full-sized avatar

Cédric Luthi 0xced

View GitHub Profile
@0xced
0xced / OpenTelemetry.AutoInstrumentation-elk.mmd
Created September 23, 2026 08:58
OpenTelemetry.AutoInstrumentation dependency diagram (elk layout)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@0xced
0xced / OpenTelemetry.AutoInstrumentation-dagre.mmd
Created September 23, 2026 08:57
OpenTelemetry.AutoInstrumentation dependency diagram (dagre layout)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@0xced
0xced / XCDFakeCarrier.m
Last active June 29, 2026 20:50
Hack to choose the displayed carrier name in the iOS simulator
//
// Copyright (c) 2012-2015 Cédric Luthi / @0xced. All rights reserved.
//
#import <Foundation/Foundation.h>
#if TARGET_OS_SIMULATOR
static const char *fakeCarrier;
static const char *fakeTime;
@0xced
0xced / sqlitepool.cs
Created June 25, 2026 08:01
Understanding Microsoft.Data.Sqlite pooling
#:package Microsoft.Data.Sqlite@10.0.9
#:package SQLitePCLRaw.bundle_e_sqlite3@3.0.3
using System.Data.Common;
using Microsoft.Data.Sqlite;
var dataSource = args.Length > 0 ? args.Last() : ":memory:";
var pooling = !args.Contains("--disable-pooling");
var clearAllPools = args.Contains("--clear-all-pools");
@0xced
0xced / Emoji-iOS-10.0-14A5322e.json
Created August 8, 2016 22:38
Emoji from iOS beta 4 (14A5322e)
{
"People" : [
{
"Symbol" : "😀",
"Name" : "GRINNING FACE"
},
{
"Symbol" : "😬",
"Name" : "GRIMACING FACE"
},
@0xced
0xced / CopyLaunchedApplicationsInFrontToBackOrder.c
Created August 7, 2009 14:06
Get an array of running applications ordered by last use
#import <Carbon/Carbon.h>
#import <dlfcn.h>
/*
* Returns an array of CFDictionaryRef types, each of which contains information about one of the processes.
* The processes are ordered in front to back, i.e. in the same order they appear when typing command + tab, from left to right.
* See the ProcessInformationCopyDictionary function documentation for the keys used in the dictionaries.
* If something goes wrong, then this function returns NULL.
*/
CFArrayRef CopyLaunchedApplicationsInFrontToBackOrder(void)
@0xced
0xced / Emoji.json
Last active March 22, 2025 15:30
Extract emoji by category using the EmojiFoundation framework
{
"People" : [
"😀",
"😃",
"😄",
"😁",
"😆",
"😅",
"😂",
"🤣",
@0xced
0xced / UIDevice+serialNumber.h
Last active March 21, 2025 02:27
UIDevice+serialNumber
/*
* Adds the serialNumber property to the UIDevice class
*
* The implementation uses undocumented (for iOS) IOKit functions,
* so handle with caution and be prepared for nil.
*/
#import <UIKit/UIDevice.h>
@interface UIDevice (serialNumber)
@0xced
0xced / StringTrimmerInterceptor.cs
Created May 2, 2024 07:10
Entity Framework Core interceptor to trim strings (remove leading and trailing spaces) before saving to database
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
namespace gist;
public class StringTrimmerInterceptor : ISaveChangesInterceptor
{
@0xced
0xced / NuGet with native dynamic libraries.txt
Created October 17, 2019 12:31
NuGet with native dynamic libraries [dylib] [dll] [so]
https://stackoverflow.com/questions/38728583/how-to-create-nuget-package-for-native-c/57616597#57616597
--> https://digitalhouseblog.wordpress.com/2019/08/22/how-to-make-a-nuget-package-for-c/
https://dev.to/jeikabu/loading-native-libraries-in-c-fh6
--> https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order
--> https://rendered-obsolete.github.io/2018/08/15/nupkg-with-native.html (broken link on dev.to)
--> https://natemcmaster.com/blog/2018/07/25/netcore-plugins/
https://stackoverflow.com/questions/49270527/can-you-dynamically-load-cross-platform-native-unmanaged-dlls-libs-in-net-core/52286519#52286519