Skip to content

Instantly share code, notes, and snippets.

View markiv's full-sized avatar

Vikram Kriplaney markiv

View GitHub Profile
@markosjal
markosjal / AirScan-eSCL.txt
Last active February 1, 2025 23:49
Reverse Engineering eSCL / Apple AirScan
Reverse Engineering the Apple Airscan / eSCL Protocol
I am not certain of the origins, one person involved in IPP printing claimed it was proprietary of HP , but then again they have their own protocol. AirScan/eSCL is used by other manufacturers too like Xerox, Kyocera, Canon and more. Mopria also seems to claim some responsibility for it but then again it seems not completely. In any case it seems shrouded in such secrecy that to date several years after its implementation, unless someone wants to take it all apart.
I offer this as my contribution. It is not perfect but almost there.
As I began looking for information to make a scanner more compatible, I could only find fragments of information. Even Apple Developer Forums offered zero help.
Server/Client in eSCL / AirScan:
There is a โ€œserverโ€and a โ€œclientโ€ the client can be a desktop computer or mobile device. The server is a scanner or another device configured to emulate a hardware scanner, even a desktop computer. In my case I did this on Linux, so
@chriseidhof
chriseidhof / collectionview.swift
Last active January 31, 2024 19:00
SwiftUI Flow Layout
//
// ContentView.swift
// DeleteMe
//
// Created by Chris Eidhof on 02.02.21.
//
import SwiftUI
/*
#!/usr/bin/env xcrun -sdk macosx swift
// Displays UI in an NSWindow which can interact with the commandline
// Usage: `echo "Bar" | ./swift-ui-commandline-tool.swift`
import Foundation
import SwiftUI
extension CommandLine {
static let input: String = { AnyIterator { readLine() }.joined() }()
import Foundation
extension String.StringInterpolation {
fileprivate static let myMeasurementFormatter: MeasurementFormatter = {
let this = MeasurementFormatter()
this.unitOptions = [.naturalScale]
this.numberFormatter.maximumFractionDigits = 1
return this
}()
mutating func appendInterpolation<UnitType>(_ measurement: Measurement<UnitType>) where UnitType: Unit {
@AliSoftware
AliSoftware / Demo.swift
Last active October 31, 2023 12:25
NestableCodingKey: Nice way to define nested coding keys for properties
struct Contact: Decodable, CustomStringConvertible {
var id: String
@NestedKey
var firstname: String
@NestedKey
var lastname: String
@NestedKey
var address: String
enum CodingKeys: String, NestableCodingKey {
@drumnkyle
drumnkyle / AllComponentPreviews.swift
Last active March 15, 2022 22:32
SwiftUI Preview Helpers for Most Edge Cases
/**
Copyright 2019 Kyle Sherman
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
@rmcdongit
rmcdongit / macOS_SytemPrefs.md
Last active September 7, 2025 02:56
Apple System Preferences URL Schemes

macOS 10.15 System Preference Panes

Below are a list of System Preference pane URLs and paths that can be accessed with scripting to assist users with enabling macOS security settings without having to walk them through launching System Preferences, finding panes, and scrolling to settings. Not all panes have an accessible anchor and some are OS specific.

To find the Pane ID of a specific pane, open the System Preferences app and select the desired Preference Pane. With the pane selected, open the ScriptEditor.app and run the following script to copy the current Pane ID to your clipboard and display any available anchors:

tell application "System Preferences"
	set CurrentPane to the id of the current pane
	set the clipboard to CurrentPane
@Akhu
Akhu / .gitignore
Last active January 2, 2023 11:10
Xcode 12 + Swift UI Gitignore
# Created by https://www.toptal.com/developers/gitignore/api/swiftpackagemanager,swift,xcode,macos
# Edit at https://www.toptal.com/developers/gitignore?templates=swiftpackagemanager,swift,xcode,macos
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
struct KeychainItem {
// MARK: Nested Types
enum KeychainError: Error {
case noPassword
case unexpectedPasswordData
case unexpectedItemData
case unhandledError(status: OSStatus)
}
@markiv
markiv / String+EmojiFlag.swift
Last active January 17, 2022 19:43
String extension to create emoji country and regional flags
extension String {
var flag: String {
uppercased().unicodeScalars
.filter { (65...90).contains($0.value) }
.compactMap { UnicodeScalar(0x1F1E6 - 65 + $0.value) }
.map(String.init)
.joined()
}
}