Skip to content

Instantly share code, notes, and snippets.

@dnicolson
dnicolson / FixAllIssues.js
Created March 3, 2024 21:36
Perform "Fix All Issues" for an array of files in Xcode
#!/usr/bin/env osascript -l JavaScript
var filePaths = [];
function fixFile(filePath) {
console.log(filePath);
var xcode = Application('Xcode');
xcode.activate();
class LlvmMingwW64 < Formula
desc "LLVM/Clang/LLD based mingw-w64 toolchain"
homepage "https://github.com/mstorsjo/llvm-mingw"
version "20230517"
on_macos do
url "https://github.com/mstorsjo/llvm-mingw/releases/download/#{version}/llvm-mingw-#{version}-ucrt-macos-universal.tar.xz"
sha256 "ad4502a4a427aa16736c59e87e2f7657fe8431002133eb286984d25c2bd2c949"
end
on_linux do
on_arm do
@dnicolson
dnicolson / apple-watch-battery
Last active September 10, 2022 00:37
Check battery level of Apple Watch via Cloud Battery and display notification if fully charged
#!/bin/bash
check_battery() {
shortcuts run 'Save Apple Watch Battery Level'
FILENAME="$HOME/Library/Mobile Documents/iCloud~is~workflow~my~workflows/Documents/AppleWatchBattery.txt"
LEVELS=(`tail -2 "$FILENAME"`)
if [[ ${LEVELS[1]} -eq 100 && ${LEVELS[1]} -gt ${LEVELS[0]} ]]; then
shortcuts run 'Apple Watch Fully Charged'
@dnicolson
dnicolson / berlin-daily-news.js
Last active October 3, 2024 10:14
Lambda to provide an RSS feed of Exberliner's daily news blog
const { parse } = require('node-html-parser');
const { Feed } = require('feed');
const fetch = require('node-fetch');
const he = require('he');
const BERLIN_DAILY_NEWS_URL = 'https://www.exberliner.com/english-news-berlin/';
const parseHomeHtml = (html) => {
const root = parse(html);
@dnicolson
dnicolson / c.tsx
Created December 5, 2021 17:09
Raycast extension to launch projects in Visual Studio Code
import { ActionPanel, showToast, ToastStyle, List, closeMainWindow } from "@raycast/api";
import fs from "fs";
import path from "path";
import { exec } from "child_process";
import untildify from "untildify";
type directories = {
[key: string]: string;
};

Signing in to Feedly with Reeder 4 on iOS

Reeder 4 works with Feedly but only if the account is already authenticated, it seems unlikely Reeder 4 will see an update to fix this. It is possible to copy the authentication from another session and add it manually to the Keychain. There are options with and without a jailbreak.

Get Feedly Authentication

The authentication can be obtained from the macOS Keychain or an iOS backup.

Option 1: macOS Keychain

@dnicolson
dnicolson / AppDelegate.swift
Created September 26, 2021 09:16
Programmatically create a UINavigationController and UITabBarController
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
self.window = UIWindow(frame: UIScreen.main.bounds)
@dnicolson
dnicolson / ios-bundle-ids.c
Created July 6, 2021 17:29
List the bundle IDs of all apps on an iOS device
// clang ios-bundle-ids.c -o ios-bundle-ids -lplist-2.0 -limobiledevice-1.0 && ./ios-bundle-ids
#include <stdio.h>
#include <stdlib.h>
#include <libimobiledevice/libimobiledevice.h>
#include <libimobiledevice/installation_proxy.h>
void list_available_apps(idevice_t dev)
{
instproxy_client_t ip = NULL;
@dnicolson
dnicolson / ViewController.swift
Created April 24, 2021 20:30
Read the home directory in a sandboxed app by calling NSOpenPanel
import Cocoa
import Foundation
class ViewController: NSViewController {
private func promptForWorkingDirectoryPermission() -> URL? {
let openPanel = NSOpenPanel()
openPanel.message = "Choose home directory"
openPanel.prompt = "Choose"
openPanel.allowedFileTypes = ["none"]
@dnicolson
dnicolson / tcf-consent-google.js
Created March 2, 2021 17:19
Simulates TCF consent for Google ads