Skip to content

Instantly share code, notes, and snippets.

@beaufortfrancois
beaufortfrancois / headless-chrome-webgpu.ipynb
Last active April 13, 2025 09:23
Supercharge Web AI model testing: WebGPU, WebGL, and Headless Chrome
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dagronf
dagronf / find-focus-stealer.swift
Last active April 9, 2025 14:04
Swift command-line tool to find which application is stealing your Mac's focus [macOS, script, steal, focus]
#!/usr/bin/swift
import Foundation
import AppKit.NSWorkspace
// Returns the name of the frontmost app, or <none> if no app is frontmost
func currentFocusApp() -> String {
NSWorkspace.shared.frontmostApplication?.localizedName ?? "<none>"
}
@kingargyle
kingargyle / End GCode
Last active February 9, 2024 10:35
Prusa Slicer Anycubic Kobra Neo
M117 Cooling down...
M104 S0 ; turn off extruder
M107 ; Fan off
M140 S0; Turn bed off
M84 ; disable motors
G91 ;relative positioning
G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure
G1 Z+0.5 E-5 ;X-20 Y-20 F240 ;move Z up a bit and retract filament even more
G28 X0 ;move X to min endstops, so the head is out of the way
G90 ;Absolute positionning
@byt3bl33d3r
byt3bl33d3r / manager-config.yml
Created November 14, 2021 19:05
Nebula configuraton files for docker swarm manager and worker nodes
# !! Remember to replace LIGHTHOUSE_IP with your actual Nebula lighthouse external IP Address
# See the example config file to know what all of these options do https://github.com/slackhq/nebula/blob/master/examples/config.yml
pki:
ca: /etc/nebula/ca.crt
cert: /etc/nebula/host.crt
key: /etc/nebula/host.key
static_host_map:
"192.168.100.1": ["<LIGHTHOUSE_IP>:4242"]
@dagronf
dagronf / Notification+Visibility.swift
Last active April 13, 2024 12:50
Observe all notifications sent through a NotificationCenter or DistributedNotificationCenter
// Observe all notifications generated by the default NotificationCenter
NotificationCenter.default.addObserver(
forName: nil, object: nil, queue: nil) { notification in
Swift.print("Notification: \(notification.name.rawValue), Object: \(notification.object)")
}
// Observe all notifications generated by the default DistributedNotificationCenter
DistributedNotificationCenter.default().addObserver(
forName: nil, object: nil, queue: nil) { notification in
Swift.print("Notification: \(notification.name.rawValue), Object: \(notification.object)")
@artem78
artem78 / SymbianDev-en.md
Last active April 26, 2025 07:53
Developing for Symbian OS guide
// Don't forget to add to the project:
// 1. DeepLabV3 - https://developer.apple.com/machine-learning/models/
// 2. CoreMLHelpers - https://github.com/hollance/CoreMLHelpers
enum RemoveBackroundResult {
case background
case finalImage
}
extension UIImage {
@dagronf
dagronf / ImageConversion.swift
Last active April 19, 2025 14:15
Extensions for converting NSImage <-> CGImage <-> CIImage
extension NSImage {
/// Create a CIImage using the best representation available
///
/// - Returns: Converted image, or nil
func asCIImage() -> CIImage? {
if let cgImage = self.asCGImage() {
return CIImage(cgImage: cgImage)
}
return nil
}
@onebytegone
onebytegone / backup-restore-docker-volume.md
Created November 14, 2018 00:59
Backup and restore a Docker volume on Mac OS X

Backup and restore a Docker volume on Mac OS X

This is a rough draft for backing up and restoring data contained in a Docker volume. I can't say that this is a "best practice". For my limited testing at the moment, it seems sufficient.

Example docker-compose.yml

version: '3'
@loganvolkers
loganvolkers / Byte Formatting for Google Sheets.md
Last active June 16, 2025 14:21
Byte formatting for Google Sheets