Skip to content

Instantly share code, notes, and snippets.

Avatar

Cédric Luthi 0xced

  • Fribourg, Switzerland
  • Twitter @0xced
View GitHub Profile
@0xced
0xced / IgnoreUpdates.m
Last active May 27, 2021
Trying to ignore the macOS Big Sur update (unsuccessfully)
View IgnoreUpdates.m
#import <Foundation/Foundation.h>
#import <sysexits.h>
/*
* Trying to bypass the fact that running `sudo /usr/sbin/softwareupdate --reset-ignored && sudo /usr/sbin/softwareupdate --ignore "macOS Big Sur"`
* does not work anymore on macOS Mojave 10.14.6 (ignored updates is empty) by using the underlying SoftwareUpdate framework directly.
* Unfortunately, this did not work as expected. The preference is written when this tool is run as root but opening the software update
* preference pane still displays the macOS Big Sur update :-(
*
* References
@0xced
0xced / EmbeddedPdbCostura.csproj
Last active Mar 3, 2021
Minimal project to test producing a single executable which embeds its dll files and its pdb
View EmbeddedPdbCostura.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net472</TargetFramework>
<DebugType>embedded</DebugType>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
<GenerateSupportedRuntime>false</GenerateSupportedRuntime>
</PropertyGroup>
@0xced
0xced / Program.cs
Created Oct 16, 2020
dnlib experiment
View Program.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using dnlib.DotNet;
namespace assemblyref
{
class Program
{
@0xced
0xced / FodyWeavers.xml
Last active Sep 14, 2020
Single exe using Microsoft.EntityFrameworkCore.Sqlite on .NET Framework 4.7.2
View FodyWeavers.xml
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Costura />
</Weavers>
@0xced
0xced / Program.cs
Created Jul 3, 2020
Formatting of -0 in .NET Core
View Program.cs
using System;
using System.Globalization;
static class Program
{
private static void Main()
{
static string FormatCoordinate(double x, double y) => $"({x.ToString(NumberFormatInfo.InvariantInfo)},{y.ToString(NumberFormatInfo.InvariantInfo)})";
const double a = 0;
const double b = 0;
View .NET global tools (dotnet tool list -g)
Package Id Version Commands
---------------------------------------------------------------------------------------
cake.tool 1.1.0 dotnet-cake
codecov.tool 1.13.0 codecov
docfx 3.0.0-beta1-0931-gac184a447e docfx
dotnet-ef 5.0.7 dotnet-ef
dotnet-runtimeinfo 1.0.4 dotnet-runtimeinfo
dotnet-script 1.1.0 dotnet-script
dotnet-sonarscanner 5.2.1 dotnet-sonarscanner
dotnet-stryker 0.22.4 dotnet-stryker
@0xced
0xced / Answer to StackOverflow-60230760.md
Last active Feb 18, 2020
Answer to "No depthData with iPhone X, iPhone XS is fine" https://stackoverflow.com/questions/60230760/no-depthdata-with-iphone-x-iphone-xs-is-fine as a gist since my answer was deleted on the grounds that a link to some other code is not an answer
View Answer to StackOverflow-60230760.md

I recently worked on a project where I had to access the depth data on an iPhone X. I forked the ALCameraViewController project and created a depth branch. You can clone my repository and checkout the depth branch. Then run the demo app and take a picture with the camera.

Put a breakpoint on line 148 of the CameraView.swift file and check if photo.depthData is nil in the photoOutput(_, didFinishProcessingPhoto, error) callback. For me it was never nil on an iPhone X.

If it's not nil then you can compare the code and understand the difference. It it's nil then it's probably a bug in iOS itself and I'd suggest you to update to the latest iOS version.

@0xced
0xced / IBSegueActionBackport.h
Created Jan 27, 2020
[Work In Progress] Backport of the IBSegueAction feature for iOS < 13
View IBSegueActionBackport.h
//
// ⚠️ WORK IN PROGRESS, NOT FUNCTIONAL ⚠️
// Backport of the IBSegueAction feature for iOS < 13
// See https://sarunw.com/posts/better-dependency-injection-for-storyboards-in-ios13/ and https://useyourloaf.com/blog/better-storyboards-with-xcode-11/
//
@import Foundation;
BOOL XCDBackportIBSegueAction(void);
@0xced
0xced / Podfile
Created Jan 23, 2020
Sample Podfile with common workarounds: disable warnings for pods, using a branch, deleting deployment target from pods project, deleting swift files
View Podfile
platform :ios, '12.0'
target 'MyApp' do
inhibit_all_warnings!
pod 'libextobjc/EXTKeyPathCoding', '0.6'
pod 'libextobjc/EXTScope', '0.6'
pod 'Mantle', '~> 2.1'
pod 'RSParser', :git => 'https://github.com/0xced/RSParser', :branch => 'nsarray'
end
@0xced
0xced / NuGet with native dynamic libraries.txt
Created Oct 17, 2019
NuGet with native dynamic libraries [dylib] [dll] [so]
View NuGet with native dynamic libraries.txt
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