Skip to content

Instantly share code, notes, and snippets.

View 0xWDG's full-sized avatar
💻
Hacking my way around

Wesley de Groot 0xWDG

💻
Hacking my way around
View GitHub Profile
@code-boxx
code-boxx / 0-PHP-PUSH.MD
Last active January 24, 2024 07:46
PHP Push Notifications
@sainecy
sainecy / RunBlocking.swift
Last active October 10, 2023 03:08
Run asynchronous blocks synchronous in swift. As Kotlin runBlocking. ONLY FOR TEST PURPOSES. Async code MUST BE RUNS ONLY ASYNCHRONOUSLY IN PRODUCTION!
import Foundation
private final class RunBlocking<T, Failure: Error> {
fileprivate var value: Result<T, Failure>? = nil
}
extension RunBlocking where Failure == Never {
func runBlocking(_ operation: @Sendable @escaping () async -> T) -> T {
Task {
let task = Task(operation: operation)
//
// ContentView.swift
// ActivityRingAnimation WatchKit Extension
//
// Created by AppleDesignDev on 1/25/22.
//
import SwiftUI
struct ContentView: View {
var body: some View {
TimelineView(.periodic(from: .now, by: 1.0)) { timeline in
@TheiOSDude
TheiOSDude / DIFactory
Created November 15, 2021 16:56
Swift DI with Factories
import UIKit
// Services conforming to protocols.
// SOLID: Depend on abstractions, not concrete implementations. Dependency Inversion principle
// DECLARE FIRST SERVICE
protocol MyFirstServiceProtocol {
func myFirstMethod()
}
@zhuowei
zhuowei / safariinject.m
Last active October 22, 2021 17:15
Restores old tab bar in Safari 15.0 (16612.1.29.41.4, 16612)
// Restores old tab bar in Safari 15.0 (16612.1.29.41.4, 16612)
// clang -fmodules -shared -Wall -Os -o libsafariinject.dylib safariinject.m
//
// If SIP off:
// DYLD_INSERT_LIBRARIES=$PWD/libsafariinject.dylib /Applications/Safari.app/Contents/MacOS/Safari
//
// If SIP on, you can demo this by manually removing Safari's code signing signature, but many
// features (eg saved logins) won't be readable by the resigned app:
// cp -a /Applications/Safari.app ./
// codesign --remove Safari.app/Contents/MacOS/Safari
@infernalheaven
infernalheaven / poc.c
Created September 16, 2021 02:18
macOS 11.5.2/iOS 14.7.1 Kernel Race Condition poc
/*
Written By Pan ZhenPeng(@peterpan980927) of Alibaba Security Pandora Lab
use it on macOS: cc poc.c -o poc while True; do ./poc ; done
*/
#include <errno.h>
#include <signal.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@unrealwill
unrealwill / collisionLSH.py
Created August 8, 2021 10:20
Proof of Concept : generating collisions on a neural perceptual hash
import tensorflow as tf #We need tensorflow 2.x
import numpy as np
#The hashlength in bits
hashLength = 256
def buildModel():
#we can set the seed to simulate the fact that this network is known and doesn't change between runs
#tf.random.set_seed(42)
model = tf.keras.Sequential()
// Original article here: https://www.fivestars.blog/code/redacted-custom-effects.html
import SwiftUI
// MARK: Step 1: Create RedactionReason
public enum RedactionReason {
case placeholder
case confidential
@unnamedd
unnamedd / MacEditorTextView.swift
Last active May 26, 2024 17:49
[SwiftUI] MacEditorTextView - A simple and small NSTextView wrapped by SwiftUI.
/**
* MacEditorTextView
* Copyright (c) Thiago Holanda 2020-2021
* https://twitter.com/tholanda
*
* MIT license
*/
import Combine
import SwiftUI
@tkafka
tkafka / listAllEventListeners.js
Last active January 24, 2024 22:52 — forked from dmnsgn/listAllEventListeners.js
List all event listeners in a document
console.table((function listAllEventListeners() {
const allElements = Array.prototype.slice.call(document.querySelectorAll('*'));
allElements.push(document); // we also want document events
const types = [];
for (let ev in window) {
if (/^on/.test(ev)) types[types.length] = ev;
}
let elements = [];
for (let i = 0; i < allElements.length; i++) {