Skip to content

Instantly share code, notes, and snippets.

View willie's full-sized avatar

Willie Abrams willie

View GitHub Profile
@OrionReed
OrionReed / dom3d.js
Last active September 19, 2024 20:10
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
#if os(macOS)
import SwiftUI
public extension View {
func hostingWindow(_ callback: @escaping (NSWindow?) -> Void) -> some View {
background(HostingWindowFinder(callback: callback))
}
func windowTitle(_ title: String) -> some View {
hostingWindow { $0?.title = title }
@stfj
stfj / review parser
Created June 8, 2023 14:36
parses reviews from appfigures
import poplib
import smtplib
from email import message_from_bytes
from email.message import EmailMessage
import openai
import re
import html
openai.api_key = ''
@mackuba
mackuba / Bluesky.swift
Created April 24, 2023 14:58
Basic Swift code to log in and send a post to Bluesky
//
// Bluesky.swift
// Created by Kuba Suder on 24/04/2023.
// Licensed under WTFPL License
//
import Foundation
struct LoginData: Encodable {
let identifier: String
@triangletodd
triangletodd / console.log
Last active February 24, 2023 20:19
Passing environment variables to docker run
$ TEST_1=one
$ TEST_2=two
$ PATTERN2_1=one
$ PATTERN2_2=two
$ docker run -d --name test $(for var in $(set | grep -E '^TEST_|^PATTERN2_'); do printf -- '-e "%s" ' $var; done) nginx
541a23d4e432b375f71b081593d533de0aeb0b918f74d911bee7c36c95bcc4e3
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
@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
//
// ContentView.swift
// MadeForYouCard
//
// Created by AppleDesignDev on 1/24/22.
//
import SwiftUI
struct ContentView: View {
@jwmoss
jwmoss / iptv_plex.md
Last active August 13, 2024 13:59
Integrating IPTV and Plex

IPTV and Plex Setup

Flow of live TV

IPTVProvider's Xtreme API Credentials --> iptvproxy (converts xtreme api to .m3u file) --> xteve --> Plex Live TV

Flow of EPG (Electronic Programming Guide)

ScheduesDirect --> xteve (version from taylorbourne) runs a cronjob every hour to keep programming up to date

@osy
osy / README.md
Last active August 9, 2023 12:58
UTM on Apple M1 Guides

Thanks to the work of @agraf, @KhaosT, @imbushuo, and others, we have Virtualization.framework working on M1 Macs. These [changes][1] have been merged with QEMU v5.2.0 RC3 (will rebase once the final release is out) and integrated with UTM, a brand new QEMU frontend designed in SwiftUI for iOS 14 and macOS 11.

Screenshot

Downloads

@tekin
tekin / .gitattributes
Last active July 9, 2024 20:31
An example .gitattributes file that will configure custom hunk header patterns for some common languages and file formats. See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details.
# Stick this in your home directory and point your Global Git config at it by running:
#
# $ git config --global core.attributesfile ~/.gitattributes
#
# See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details
*.c diff=cpp
*.h diff=cpp
*.c++ diff=cpp
*.h++ diff=cpp