Skip to content

Instantly share code, notes, and snippets.

View jacobsapps's full-sized avatar

Jacob Bartlett jacobsapps

View GitHub Profile
func run() {
var data = Data()
print("empty")
data.append(0x01)
print("inline")
data.append(contentsOf: [UInt8](repeating: 0xFF, count: 20))
print("inline slice")
10 HOME
15 X = 10: Y = 10
20 VTAB Y: HTAB X: PRINT "@";
30 GET K$: IF K$ = "" THEN GOTO 30
40 REM ERASE CURRENT
50 VTAB Y: HTAB X: PRINT " ";
60 REM HANDLE INPUT
70 IF K$ = "A" THEN X = X - 1
#import <Foundation/Foundation.h>
#import <dispatch/dispatch.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
printf("[Main Thread] Application started.\n");
printf("[Main Thread] Initiating a heavy task on a background queue...\n");
dispatch_queue_t backgroundQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
#import <stdio.h>
#import <stdlib.h>
#import <pthread.h>
#import <unistd.h> // for sleep()
pthread_mutex_t printLock;
void* countdown(void* arg) {
int id = *((int*)arg);
for (int i = 5; i >= 1; i--) {
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
// we're aliasing here since modern MacOS doesn't use the same system toolbox
void SystemTask() { usleep(50000); } // Yield to system
int WaitNextEvent() { SystemTask(); return rand() % 2; } // 50% chance of event
void doStuff() { printf("Doing stuff!\n"); }
typedef const struct _libkernel_functions {
/* The following functions are included in version 1 of this structure */
unsigned long version;
void* (*LIBKERNEL_FUNCTION_PTRAUTH(dlsym))(void*, const char*);
void* (*LIBKERNEL_FUNCTION_PTRAUTH(malloc))(size_t);
void(*LIBKERNEL_FUNCTION_PTRAUTH(free))(void*);
void* (*LIBKERNEL_FUNCTION_PTRAUTH(realloc))(void*, size_t);
void(*LIBKERNEL_FUNCTION_PTRAUTH(_pthread_exit_if_canceled))(int);
/* The following functions are included in version 2 of this structure */
@jacobsapps
jacobsapps / CoreMLProcessing.swift
Created June 4, 2025 06:23
CoreMLProcessing.swift
import Vision
import UIKit
import ImageIO
struct TitleEmbedding: Codable {
let fullNameCopy: String
let keyword: String
let embedding: [Float]
}
@jacobsapps
jacobsapps / CoreMLProcessing.swift
Created June 4, 2025 06:23
CoreMLProcessing.swift
import Vision
import UIKit
import ImageIO
struct TitleEmbedding: Codable {
let fullNameCopy: String
let keyword: String
let embedding: [Float]
}
// CoreMLProcessing.swift
private var statsEmbeddings: [StatEmbedding] = []
private var titleEmbeddings: [TitleEmbedding] = []
func loadCLIPModelAndEmbeddings() {
model = nil
statsEmbeddings = []
titleEmbeddings = []
import os
import json
import numpy as np
import coremltools as ct
from transformers import CLIPTokenizer
# 1. Load titles list with descriptions
titles = []
with open("names.txt", "r", encoding="utf-8") as f:
for line in f: