Skip to content

Instantly share code, notes, and snippets.

@knightsc
knightsc / inject.c
Last active May 21, 2024 15:22
An example of how to inject code to call dlopen and load a dylib into a remote mach task. Tested on 10.13.6 and 10.14.3
#include <dlfcn.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <mach/mach.h>
#include <mach/error.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/sysctl.h>
#include <sys/mman.h>
@rvrsh3ll
rvrsh3ll / windows-keys.md
Created February 18, 2024 22:44
Windows Product Keys

NOTE

These are NOT product / license keys that are valid for Windows activation.
These keys only select the edition of Windows to install during setup, but they do not activate or license the installation.

Index

Edge Chromium

Note: If your system region is part of the EEA the option to uninstall Edge normally is rolling out in the latest updates for Windows and Edge. With some registry edits, you can change the region after install.

HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge, remove NoRemove.

HKLM\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\ClientState\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}, delete experiment_control_labels if it exists.

Create HKLM\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdateDev and add the AllowUninstall value. This replaces the experiment_control_labels blocker on later versions of Edge.

@umair-me
umair-me / context.cs
Last active May 21, 2024 15:15
EF Core Set all foreign keys to delete restrict
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
foreach (var relationship in modelBuilder.Model.GetEntityTypes().SelectMany(e => e.GetForeignKeys()))
relationship.DeleteBehavior = DeleteBehavior.Restrict;
}
@onildoaguiar
onildoaguiar / sorting-an-array-by-date-with-moment-js.md
Last active May 21, 2024 15:15
Sorting an array by date with Moment.js
const Moment = require('moment')
const array = [{date:"2018-05-11"},{date:"2018-05-12"},{date:"2018-05-10"}]
const sortedArray  = array.sort((a,b) => new Moment(a.date).format('YYYYMMDD') - new Moment(b.date).format('YYYYMMDD'))
console.log(sortedArray)
@bergmannjg
bergmannjg / rearct-native-app-in-wsl2.md
Last active May 21, 2024 15:14
Building a react native app in WSL2
@qoomon
qoomon / conventional_commit_messages.md
Last active May 21, 2024 15:13
Conventional Commit Messages

Conventional Commit Messages

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions and generate verion and changelogs

Commit Message Formats

Default

@groue
groue / ObservableState.swift
Last active May 21, 2024 15:12
WithBindable
import SwiftUI
/// Supplies an observable object to a view’s hierarchy.
///
/// The purpose of `WithBindable` is to make it possible to instantiate
/// observable objects from environment values, while keeping the object
/// alive as long as the view is rendered.
///
/// For example:
///
@PimCoumans
PimCoumans / AnimationSequece.swift
Last active May 21, 2024 15:12
Simple way to chain and group multiple UIView animations
import UIKit
protocol StepAnimatable {
/// Start a sequence where you add each step in the `addSteps` closure. Use the provided `AnimationSequence` object
/// to add each step which should either be an actual animation or a delay.
/// The `completion` closure is executed when the last animation has finished.
/// - Parameters:
/// - addSteps: Closure used to add steps to the provided `AnimationSequence` object
/// - completion: Executed when the last animation has finished.
@Blackshome
Blackshome / low-battery-notifications-and-actions.yaml
Last active May 21, 2024 15:10
low-battery-notifications-and-actions.yaml
blueprint:
name: Low Battery Notifications & Actions
description: >
# 🪫 Low Battery Notifications & Actions
**Version: 2.1**
🚀 Stay Charged, Stay Smart! Let's automate and take charge of your battery maintenance!🔋⚡