Skip to content

Instantly share code, notes, and snippets.

View b5i's full-sized avatar
📖
Working

Antoine Bollengier b5i

📖
Working
View GitHub Profile
@stephancasas
stephancasas / IntelligenceUIPlatterView.swift
Created February 14, 2025 23:49
A SwiftUI expression of Apple Intelligence' NSIntelligenceUIPlatterView — used to accent intelligence-enabled UI components.
//
// IntelligenceUIPlatterView.swift
//
// Created by Stephan Casas on 2/13/25.
//
import SwiftUI
import AppKit
import Combine
@beader
beader / 0-InfinitePageView for SwiftUI.md
Last active March 26, 2025 11:33
Create a InfinitePageView for SwiftUI using UIViewControllerRepresentable by the help of ChatGPT

InfinitePageView for SwiftUI

Create a Bi-directional Infinite PageView for SwiftUI using UIViewControllerRepresentable & UIPageViewController by the help of ChatGPT.

Checkout the video demo in the comment.

The code is generated by ChatGPT through multiple rounds of conversations. Checkout the conversations between ChatGPT and me if you are interested in.

@eyecatchup
eyecatchup / calc-sapisidhash.js
Last active May 2, 2025 16:06
Calculate SAPISIDHASH
// Generates the SAPISIDHASH token Google uses in the Authorization header of some API requests
async function getSApiSidHash(SAPISID, origin) {
function sha1(str) {
return window.crypto.subtle.digest("SHA-1", new TextEncoder("utf-8").encode(str)).then(buf => {
return Array.prototype.map.call(new Uint8Array(buf), x=>(('00'+x.toString(16)).slice(-2))).join('');
});
}
const TIMESTAMP_MS = Date.now();
const digest = await sha1(`${TIMESTAMP_MS} ${SAPISID} ${origin}`);
@Ridwy
Ridwy / MTAudioProcessingTapSample.swift
Created July 30, 2021 11:21
How to use MTAudioProcessingTap in Swift 5
//
// Created by Chiharu Nameki @Ridwy on 2021/07/30.
//
import UIKit
import AVFoundation
/*
Using MTAudioProcessingTap, you can touch raw audio samples playing with AVPlayer.
This sample code shows how to use MTAudioProcessingTap in Swift 5.
@nesium
nesium / class_addMethod.swift
Created June 12, 2018 10:18
Add method to Obj-C class from Swift
let cls: AnyClass = NSClassFromString("NSConcreteValue")!
let types = "d@:" // [NSString stringWithFormat:@"%s%s%s", @encode(double), @encode(id), @encode(SEL)]
let block: @convention(block) (AnyObject?) -> Double = { (self: AnyObject!) -> (Double) in
return 1.0
}
let imp = imp_implementationWithBlock(unsafeBitCast(block, to: AnyObject.self))
class_addMethod(cls, Selector("doubleValue"), imp, types)
@tzmartin
tzmartin / m3u8-to-mp4.md
Last active September 15, 2025 01:45
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@mkuliszkiewicz
mkuliszkiewicz / gist:c81e4a0e84d9e7db5ffbff2879062366
Created July 15, 2016 12:47
LLDB Cast address to Obj-C object while using swift
expr -l objc++ -O -- [(UIWebView *)0x7fa1d8e37320 stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML"]
@hcrub
hcrub / HCClassAddIvar.m
Created November 7, 2013 17:42
Objective C Runtime's class_addIvar adding a new instance variable to a class
/**
* class_addIvar
* Adds a new instance variable to a class.
*
* BOOL class_addIvar(Class cls, const char *name, size_t size, uint8_t alignment, const char *types)
*
* Return Value
* YES if the instance variable was added successfully, otherwise NO.
**/