Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
from jsmin import jsmin as jsminify
from htmlmin import minify as htmlminify
from csscompressor import compress as cssminify
import gzip
import sys
import os.path
import argparse
import re
@iangray001
iangray001 / safari-favicons.sh
Last active July 21, 2020 20:16 — forked from dardo82/safari-favicons.sh
Add Touch Icons into Safari's icon cache for sites that have not declared them
#!/bin/sh
# Add Touch Icons to Safari's cache
# Theory of operation is that the domain from the URL of each bookmark is MD5 hashed and used as the filename of a PNG stored in $DIR
# The URL is the domain and subdomain, with no protocol, or path. So for example "app.slack.com" or "discordapp.com".
# Yes this means that multiple sites might collide, and seems to be a weakness of Safari's scheme.
# So this script searches Bookmarks.plist to find the bookmark in question, grabs the URL, hashes it, and copies the new icon named $DIR/${HASH}.png
# Usage: Create PNG files named the same as a bookmarks you want to add. So to add a Touch Icon for a bookmark called Gmail, create a PNG called Gmail.png. Run this script in the directory with the PNGs.
DIR="$HOME/Library/Safari/Touch Icons Cache/Images"
@iangray001
iangray001 / gist:d1a7ad9cfda411131171c427563fd38e
Last active May 28, 2024 09:12
How to fetch certificates from the user's keychain using Swift
import Foundation
import Security
var dataTypeRef: CFTypeRef?
let rv = SecItemCopyMatching(
[
kSecClass: kSecClassCertificate,
kSecReturnAttributes: true,
kSecReturnRef: true,
kSecReturnData: true,