Skip to content

Instantly share code, notes, and snippets.

@haileyok
haileyok / ViewController.swift
Created May 4, 2024 05:22
UIImageView VisionKit Image Analyzer Crash Repro
import UIKit
import VisionKit
class ViewController: UIViewController {
var imageView: UIImageView?
@available(iOS 16.0, macCatalyst 17.0, *)
static let imageAnalyzer = ImageAnalyzer.isSupported ? ImageAnalyzer() : nil
override func viewDidLoad() {
@haileyok
haileyok / blah.js
Last active April 4, 2024 22:32
quote the post you create
import {BskyAgent} from '@atproto/api'
import {dataToCborBlock, TID} from '@atproto/common'
import {lexToIpld} from '@atproto/lexicon'
import {cborToLex} from '@atproto/repo'
const agent = new BskyAgent({
service: 'https://pds.haileyok.com',
})
const doIt = async () => {
@haileyok
haileyok / bean-labeler.ts
Last active March 16, 2024 20:09
Bean Auto Labeler
import {
AppBskyEmbedImages,
AppBskyFeedPost,
BskyAgent,
} from '@atproto/api'
import * as dotenv from 'dotenv'
import {ComAtprotoSyncSubscribeRepos, subscribeRepos, SubscribeReposMessage} from 'atproto-firehose'
import Anthropic from '@anthropic-ai/sdk'
import axios from 'axios'
{
"version": 0,
"bundler": "metro",
"clientVersion": "1.72",
"fileMetadata": {
"ios": {
"bundle": "bundles/e66baa6dc08188f2648433eac3e8820a.bundle",
"assets": [
"assets/7d40544b395c5949f4646f5e150fe020.png",
"assets/cdd04e13d4ec83ff0cd13ec8dabdc341.png",
Example: https://github.com/expo/custom-expo-updates-server/blob/468b7182abe2c888a5d605e902cbca37eaf42bc1/expo-updates-server/pages/api/manifest.ts#L131
id: Unique string, uuid.v4() maybe
createdAt: unix timestamp of the deployment
runtimeVersion: passed in through a header (or url param, whatever works) when sending from github action to server
launchAsset: metadata.json -> fileMetadata -> ios/android -> bundle. This should probably only be the file name,
not the entire path.
assets: metadata.json -> fileMetadata -> ios/android -> assets. The distinction between platforms seems important,
since not all assets are used on either platform.
metadata: empty object
{
"version": 0,
"bundler": "metro",
"fileMetadata": {
"ios": {
"bundle": "_expo/static/js/ios/index-b89220236b2baeffabcb4ebc36b2c018.hbc",
"assets": [
{
"path": "assets/7d40544b395c5949f4646f5e150fe020",
"ext": "png"
libc++abi: terminating due to uncaught exception of type std::__1::bad_function_call: std::exception
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x000000010612c9ec libsystem_kernel.dylib`__pthread_kill + 8
frame #1: 0x00000001063d71d0 libsystem_pthread.dylib`pthread_kill + 256
frame #2: 0x00000001801605cc libsystem_c.dylib`abort + 104
frame #3: 0x000000018028ec78 libc++abi.dylib`abort_message + 128
frame #4: 0x000000018028017c libc++abi.dylib`demangling_terminate_handler() + 272
frame #5: 0x000000018005fc00 libobjc.A.dylib`_objc_terminate() + 140
frame #6: 0x000000018028e150 libc++abi.dylib`std::__terminate(void (*)()) + 12
{
"feed": [
{
"post": {
"uri": "at://did:plc:oisofpd7lj26yvgiivf3lxsi/app.bsky.feed.post/3kmgmxn5omk2g",
"cid": "bafyreigwb5pgppijhpywi7pyyq57ardgpwo3qc6fx4mi2j5alzilwoy7je",
"author": {
"did": "did:plc:oisofpd7lj26yvgiivf3lxsi",
"handle": "haileyok.com",
"displayName": "Hailey (internected)",
"feed": [
{
"post": {
"uri": "at://did:plc:oisofpd7lj26yvgiivf3lxsi/app.bsky.feed.post/3kmgmxn5omk2g",
"cid": "bafyreigwb5pgppijhpywi7pyyq57ardgpwo3qc6fx4mi2j5alzilwoy7je",
"author": {
"did": "did:plc:oisofpd7lj26yvgiivf3lxsi",
"handle": "haileyok.com",
"displayName": "Hailey (internected)",
"avatar": "https://cdn.bsky.app/img/avatar/plain/did:plc:oisofpd7lj26yvgiivf3lxsi/bafkreidw3hckh7obhp25wev2htzcpwtzvvwymc6oyfii6w3h2q2e2ofqwe@jpeg",
@haileyok
haileyok / migrate.js
Last active May 11, 2024 19:44
Migrate PDS script
import AtpAgent from '@atproto/api'
import { Secp256k1Keypair } from '@atproto/crypto'
import * as ui8 from 'uint8arrays'
const OLD_PDS_URL = 'https://bsky.social'
const NEW_PDS_URL = 'https://pds.haileyok.com'
const CURRENT_HANDLE = 'haileyok.com'
const CURRENT_PASSWORD = ''
const NEW_HANDLE = 'newphone.pds.haileyok.com'
const NEW_ACCOUNT_EMAIL = ''