Skip to content

Instantly share code, notes, and snippets.

View imWildCat's full-sized avatar

Mike Chong imWildCat

  • Canada
View GitHub Profile
@da-luggas
da-luggas / high-lighter.py
Created October 24, 2023 12:15
Export all highlights and notes from apple books on macos
import sqlite3
import glob
import csv
import os
def get_annotation_db_path():
pattern = os.path.expanduser("~/Library/Containers/com.apple.iBooksX/Data/Documents/AEAnnotation/AEAnnotation*.sqlite")
return glob.glob(pattern)[0]
def get_library_db_path():
from langchain.llms.base import LLM
from typing import Optional, List
from revChatGPT.V1 import Chatbot
class revChatGPT(LLM):
chatbot: Chatbot = Chatbot(config={
"access_token": "<your token here>"
})
@reubenmiller
reubenmiller / tedge-cross-compile-with-zig.md
Last active May 20, 2024 09:56
How to cross compile tedge using zig

How to cross compile a rust project using zig? wtf.

I was able to compile and cross compile the gnu and musl variants to all of our target triples :)

  1. Install the cargo-zigbuild and dependencies (requires python3)

    pip3 install ziglang
    cargo install cargo-zigbuild
@RobertAKARobin
RobertAKARobin / safari.md
Last active January 5, 2024 05:41
Safari's date-picker is the cause of 1/3 of our customer support issues

Safari's date-picker is the cause of 1/3 of our customer support issues

...and obviously we're building a workaround. But I'm absolutely flabbergasted that a standard <input type="date"> HTML field, in a standard browser, from a company that bases its reputation good design, could be so dreadful.

The context

I'm the developer for a startup that sells a genetic test to recommend medications for high blood pressure. For medical reasons we need to know our customers' birth date. Most of our customers are in their 60s or older. We've found that many of them use iPads or iPhones. And they're the ones who complain to our customer support that our site is unusable.

The problem

@insidegui
insidegui / reloadplugins.sh
Created January 29, 2022 23:00
Make your Mac app's extensions immediately available on macOS with a run script build phase
# Add this to a "Run Script" build phase in your app's main target, as the last step.
# It will use the pluginkit command-line tool to force the plugin system on macOS to add your extensions to its database, making them available.
# I made this specifically for widgets, but it should work for pretty much any extension type (appex bundle).
find $CODESIGNING_FOLDER_PATH -name '*.appex' -exec pluginkit -a {} \;
import UIKit
extension UITextField {
/// Add a trailing placeholder label that tracks the text as it changes
func addTrailingPlaceholder(_ placeholder: String) {
let label = UILabel()
label.text = placeholder
label.alpha = 0.3
label.isHidden = true
let container = UIView()
@fatbobman
fatbobman / publishedObject.swift
Last active May 11, 2022 10:03
Similar to the @published implementation. Reference type support
@propertyWrapper
public struct PublishedObject<Value: ObservableObject> { // wrappedValue 要求符合 ObservableObject
public var wrappedValue: Value
public init(wrappedValue: Value) {
self.wrappedValue = wrappedValue
}
public static subscript<OuterSelf: ObservableObject>(
_enclosingInstance observed: OuterSelf,
@ibireme
ibireme / kpc_demo.c
Last active June 1, 2024 07:38
A demo shows how to read Intel or Apple M1 CPU performance counter in macOS.
// =============================================================================
// XNU kperf/kpc demo
// Available for 64-bit Intel/Apple Silicon, macOS/iOS, with root privileges
//
//
// Demo 1 (profile a function in current thread):
// 1. Open directory '/usr/share/kpep/', find your CPU PMC database.
// M1 (Pro/Max/Ultra): /usr/share/kpep/a14.plist
// M2 (Pro/Max): /usr/share/kpep/a15.plist
// M3: /usr/share/kpep/as1.plist
@bagder
bagder / h3-server-howto.md
Last active March 10, 2024 21:13
Setup an HTTP/3 test server

Setup a local HTTP/3 test server

... to toy with and run curl against it.

This is not advice on how to run anything in production. This is for development and experimenting.

Preqreqs

An existing local HTTP/1.1 server that hosts files. Preferably also a few huge ones.

// ==UserScript==
// @name Auto Skip YouTube Ads
// @version 1.0.2
// @description Speed up and skip YouTube ads automatically
// @author codiac-killer
// @match *://*.youtube.com/*
// @exclude *://*.youtube.com/subscribe_embed?*
// ==/UserScript==
let main = new MutationObserver(() => {