Skip to content

Instantly share code, notes, and snippets.

View mackuba's full-sized avatar
🦋
Building things for Bluesky with ATProto

Kuba Suder mackuba

🦋
Building things for Bluesky with ATProto
View GitHub Profile
@marckohlbrugge
marckohlbrugge / bluesky.rb
Last active November 16, 2024 01:25
work in progress implementation of `omniauth-bluesky`
require 'omniauth-oauth2'
require 'openssl'
require 'jwt'
require 'securerandom'
module OmniAuth
module Strategies
class Bluesky < OmniAuth::Strategies::OAuth2
option :name, 'bluesky'
sudo port install rbenv ruby-build
rbenv install 2.7.6
rbenv global 2.7.6
eval "$(rbenv init - bash)"
cd social-web
bundler install
nvm use # v18
corepack enable # this makes yarn available
yarn exec env # smoketest for yarn
@haileyok
haileyok / migrate.js
Last active October 20, 2024 19:29
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 = ''
@nicklockwood
nicklockwood / OSKit.swift
Created January 28, 2023 11:32
A lightweight approach to writing cross-platform code in SwiftUI without a lot of conditional compilation blocks
import SwiftUI
enum OSDocumentError: Error {
case unknownFileFormat
}
#if canImport(UIKit)
import UIKit
//
// A Swift property wrapper for adding "indirect" to struct properties.
// Enum supports this out of the box, but for some reason struct doesn't.
//
// This is useful when you want to do something recursive with structs like:
//
// struct Node {
// var next: Node?
// }
//
@steipete
steipete / RandomColor.swift
Created April 6, 2021 17:20
Random Color for SwiftUI
extension Color {
/// Return a random color
static var random: Color {
return Color(
red: .random(in: 0...1),
green: .random(in: 0...1),
blue: .random(in: 0...1)
)
}
}
@williballenthin
williballenthin / macOS_savedstate.py
Last active September 5, 2024 13:19
parse macOS savedState files
'''
parse SavedState artifacts extracted from OSX.
author: Willi Ballenthin (william.ballenthin@fireeye.com)
license: Apache 2.0
'''
import re
import sys
import json
import struct
@Przemyslaw-Wosko
Przemyslaw-Wosko / CodableExtensions.swift
Created May 2, 2019 09:18
Handy extension for Codable + transformers
import Foundation
protocol TransformerType {
associatedtype Object
associatedtype JSON
func transformFromJSON(_ value: Any) throws -> Object
func transformToJSON(_ value: Object) throws -> JSON
}
@marcrasi
marcrasi / XXXX-constexpr.md
Last active December 20, 2024 12:24
Compile Time Constant Expressions for Swift
@mminer
mminer / NSImage+Oval.swift
Last active November 5, 2022 23:02
Creates a new NSImage with a circular mask.
import AppKit
extension NSImage {
/// Copies this image to a new one with a circular mask.
func oval() -> NSImage {
let image = NSImage(size: size)
image.lockFocus()
NSGraphicsContext.current?.imageInterpolation = .high