Skip to content

Instantly share code, notes, and snippets.

View adamhill's full-sized avatar

Adam Hill adamhill

View GitHub Profile

Benro Polaris Cables Demystified

The Benro Polaris is a fantastically compact motorized 2-axis (or 3-axis with astro mod) electric tripod head with a very active user community.

USB Type-C to USB Type-C Camera Control Cable

One of the biggest sources of user confusion is the cables. All of the cables connecting to the Benro Polaris use the USB-C connector, but none of them are actually valid USB-C standards-compliant cables.

TL;DR - Use the Official Benro Cables Exactly as Documented

@metasidd
metasidd / PillButtons.swift
Last active June 30, 2024 02:45
Pill Buttons - Mail App iOS 18 - SwiftUI
//
// PillButtons.swift
//
// Created by Siddhant Mehta on 6/11/24
// Twitter: @metasidd
//
// Feel free to reuse, or remix.
import SwiftUI
@airspeedswift
airspeedswift / spellcheck.swift
Last active June 21, 2024 07:57
A simple spelling corrector in Swift
// Swift version of the spelling checker described in http://norvig.com/spell-correct.html
import Foundation
let alphabet = "abcdefghijklmnopqrstuvwxyz"
/// Given a word, produce a set of possible edits with one character
/// transposed, deleted, replaced or a rogue character inserted
func edits(_ word: String) -> Set<String> {
@OrionReed
OrionReed / dom3d.js
Last active July 22, 2024 08:58
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; // ¯\\_(ツ)_/¯

During the past days, this great article by Sam Pruden has been making the rounds around the gamedev community. While the article provides an in-depth analysis, its a bit easy to miss the point and exert the wrong conclusions from it. As such, and in many cases, users unfamiliar with Godot internals have used it points such as following:

  • Godot C# support is inefficient
  • Godot API and binding system is designed around GDScript
  • Godot is not production ready

In this brief article, I will shed a bit more light about how the Godot binding system works and some detail on the Godot

@ryanlintott
ryanlintott / WidgetConfiguration+disfavoredLocationsIfAvailable.swift
Created September 11, 2023 18:49
Sets the disfavored locations for a widget if the option is available (iOS 17 and up). Otherwise returns the same configuration.
//
// WidgetConfiguration+extensions.swift
//
//
// Created by Ryan Lintott on 2023-09-11.
//
import SwiftUI
import WidgetKit
@kconner
kconner / macOS Internals.md
Last active July 7, 2024 19:42
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@wiseman
wiseman / main.py
Last active April 4, 2023 14:36
Print the 10 closest spacecraft/satellites.
import datetime
import requests
import math
import ephem
import os
import sys
def get_tles():
if os.path.exists("active.txt") and (datetime.datetime.utcnow() - datetime.datetime.utcfromtimestamp(os.path.getmtime("active.txt"))).total_seconds() < 3600:
@nmwsharp
nmwsharp / printarr
Last active October 24, 2023 08:06
Pretty print tables summarizing properties of tensor arrays in numpy, pytorch, jax, etc. --- now on pip: `pip install arrgh`
Pretty print tables summarizing properties of tensor arrays in numpy, pytorch, jax, etc.
Now on pip! `pip install arrgh` https://github.com/nmwsharp/arrgh
@jaredpar
jaredpar / community-standup-explained.cs
Created January 12, 2023 23:35
This is the code I demonstrated at the .NET Community Standup on 2023/1/12 with comments to explain how it works.
using System;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
#nullable disable
// The stand up link https://www.youtube.com/watch?v=jaPk6Nt33KM
// String vs. string