-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f4e03e7
Showing
42 changed files
with
110,802 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
6.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
16.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
|
||
extends: default | ||
|
||
ignore: | ||
- '**/.build' | ||
- '**/DerivedData' | ||
|
||
rules: | ||
|
||
# The default line-length of 80 is a bit too restrictive. | ||
line-length: | ||
max: 120 | ||
|
||
# GitHub's workflow schema includes a key named "on" which trips this rule. | ||
# We'll disable the check for keys only, so it will still check values. | ||
truthy: | ||
check-keys: false | ||
ignore: | | ||
* | ||
!.github/workflows |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"fileScopedDeclarationPrivacy": { | ||
"accessLevel": "private" | ||
}, | ||
"indentation": { | ||
"tabs": 1 | ||
}, | ||
"indentConditionalCompilationBlocks": true, | ||
"indentSwitchCaseLabels": true, | ||
"lineBreakAroundMultilineExpressionChainComponents": false, | ||
"lineBreakBeforeControlFlowKeywords": false, | ||
"lineBreakBeforeEachArgument": false, | ||
"lineBreakBeforeEachGenericRequirement": false, | ||
"lineLength": 120, | ||
"maximumBlankLines": 1, | ||
"multiElementCollectionTrailingCommas": true, | ||
"noAssignmentInExpressions": { | ||
"allowedFunctions": ["XCTAssertNoThrow"] | ||
}, | ||
"prioritizeKeepingFunctionOutputTogether": false, | ||
"respectsExistingLineBreaks": true, | ||
"rules": { | ||
"AllPublicDeclarationsHaveDocumentation": false, | ||
"AlwaysUseLiteralForEmptyCollectionInit": false, | ||
"AlwaysUseLowerCamelCase": true, | ||
"AmbiguousTrailingClosureOverload": true, | ||
"BeginDocumentationCommentWithOneLineSummary": false, | ||
"DoNotUseSemicolons": true, | ||
"DontRepeatTypeInStaticProperties": true, | ||
"FileScopedDeclarationPrivacy": true, | ||
"FullyIndirectEnum": true, | ||
"GroupNumericLiterals": true, | ||
"IdentifiersMustBeASCII": true, | ||
"NeverForceUnwrap": true, | ||
"NeverUseForceTry": true, | ||
"NeverUseImplicitlyUnwrappedOptionals": true, | ||
"NoAccessLevelOnExtensionDeclaration": true, | ||
"NoAssignmentInExpressions": true, | ||
"NoBlockComments": true, | ||
"NoCasesWithOnlyFallthrough": true, | ||
"NoEmptyTrailingClosureParentheses": true, | ||
"NoLabelsInCasePatterns": true, | ||
"NoLeadingUnderscores": false, | ||
"NoParensAroundConditions": true, | ||
"NoPlaygroundLiterals": true, | ||
"NoVoidReturnOnFunctionSignature": true, | ||
"OmitExplicitReturns": false, | ||
"OneCasePerLine": true, | ||
"OneVariableDeclarationPerLine": true, | ||
"OnlyOneTrailingClosureArgument": true, | ||
"OrderedImports": true, | ||
"ReplaceForEachWithForLoop": true, | ||
"ReturnVoidInsteadOfEmptyTuple": true, | ||
"TypeNamesShouldBeCapitalized": true, | ||
"UseEarlyExits": true, | ||
"UseExplicitNilCheckInConditions": true, | ||
"UseLetInEveryBoundCaseVariable": true, | ||
"UseShorthandTypeNames": true, | ||
"UseSingleLinePropertyGetter": true, | ||
"UseSynthesizedInitializer": true, | ||
"UseTripleSlashForDocumentationComments": true, | ||
"UseWhereClausesInForLoops": true, | ||
"ValidateDocumentationComments": true | ||
}, | ||
"spacesAroundRangeFormationOperators": true, | ||
"tabWidth": 4, | ||
"version": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = tab | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.{yml,yaml,pkr.hcl}] | ||
indent_size = 2 | ||
indent_style = space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
|
||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
||
version: 2 | ||
updates: | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
|
||
- package-ecosystem: "swift" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
|
||
name: Test | ||
|
||
on: | ||
pull_request: | ||
branches: main | ||
|
||
jobs: | ||
test: | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Test | ||
run: | | ||
sudo xcode-select --switch "/Applications/Xcode_16_beta_6.app" | ||
make ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.build/ | ||
.DS_Store | ||
.netrc | ||
.swiftpm/configuration/registries.json | ||
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata | ||
*.xcodeproj | ||
*.xcworkspace | ||
Derived/ | ||
DerivedData/ | ||
graph.dot | ||
Package.resolved | ||
Packages/ | ||
xcuserdata/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[tools] | ||
just = "latest" | ||
shfmt = "latest" | ||
tuist = "latest" | ||
xcodes = "latest" | ||
yamllint = "latest" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"type": "lldb", | ||
"request": "launch", | ||
"args": [], | ||
"cwd": "${workspaceFolder:workbench}/src/sw_vers", | ||
"name": "Debug sw_vers (src/sw_vers)", | ||
"program": "${workspaceFolder:workbench}/src/sw_vers/.build/debug/sw_vers", | ||
"preLaunchTask": "swift: Build Debug sw_vers (src/sw_vers)" | ||
}, | ||
{ | ||
"type": "lldb", | ||
"request": "launch", | ||
"args": [], | ||
"cwd": "${workspaceFolder:workbench}/src/sw_vers", | ||
"name": "Release sw_vers (src/sw_vers)", | ||
"program": "${workspaceFolder:workbench}/src/sw_vers/.build/release/sw_vers", | ||
"preLaunchTask": "swift: Build Release sw_vers (src/sw_vers)" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"cSpell.words": [ | ||
"othr" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright © 2024 Isaac Halvorson | ||
|
||
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 portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# config | ||
.PHONY: * # all targets phony | ||
$(V).SILENT: # all targets silent | ||
|
||
# variables | ||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) | ||
project_root := $(realpath $(dir $(mkfile_path))) | ||
scripts_dir := $(project_root)/scripts | ||
|
||
up: | ||
"$(scripts_dir)/up.bash" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Notes | ||
|
||
This document contains notes to myself for reference later. | ||
|
||
## Example Commands | ||
|
||
### Shell Commands | ||
|
||
#### User Accounts | ||
|
||
Can use the `dscl` binary, or the OpenDirectory framework. | ||
|
||
Some examples of using `dscl`: | ||
|
||
Get all user accounts on the machine | ||
|
||
```shell | ||
/usr/bin/dscl -plist localhost readall /Local/Default/Users UniqueID RecordName RealName NFSHomeDirectory HomeDirectory IsHidden | ||
``` | ||
|
||
Get user accounts in the admin group | ||
|
||
```shell | ||
/usr/bin/dscl -plist localhost read /Local/Default/Groups/admin GroupMembership | ||
``` | ||
|
||
Some examples of using OpenDirectory: | ||
|
||
```swift | ||
import OpenDirectory | ||
|
||
let session = ODSession.default() | ||
let node = try ODNode(session: session, name: "/Local/Default") | ||
let query = try ODQuery( | ||
node: node, | ||
forRecordTypes: kODRecordTypeUsers, | ||
attribute: nil, | ||
matchType: 0, | ||
queryValues: nil, | ||
returnAttributes: nil, | ||
maximumResults: 0 | ||
) | ||
|
||
let results = try query.resultsAllowingPartial(false) | ||
for result in results { | ||
dump(result) | ||
} | ||
``` | ||
|
||
Library for styled TUI components: <https://github.com/dduan/Termbox> | ||
|
||
Information about Mac computers located at `/System/Library/PrivateFrameworks/ServerInformation.framework/Versions/A/Resources/en.lproj/SIMachineAttributes.plist` | ||
|
||
```swift | ||
import OSLog | ||
|
||
// Extension that makes it a breeze to create a logger that is | ||
// configured with an appropriate subsystem and category ✨ | ||
// source: // Source: https://mastodon.social/@simonbs/111985986963709036 | ||
extension Logger { | ||
init<T>(forType type: T.Type) { | ||
let subsystem = Bundle.main.bundleIdentifier! | ||
let category = String(describing: type) | ||
self.init(subsystem: subsystem, category: category) | ||
} | ||
} | ||
|
||
// Example usage 👇 | ||
struct MyStruct { | ||
private let logger = Logger(forType: Self.self) | ||
|
||
func performOperation() { | ||
logger.info("Performing operation...") | ||
// ... | ||
logger.info("Did perform operation.") | ||
} | ||
} | ||
``` | ||
|
||
- https://github.com/QiuZhiFei/swift-commands | ||
- https://macdevelopers.wordpress.com/2014/01/24/programmatically-retrieving-system-information-on-mac/ | ||
- https://opensource.apple.com/source/system_cmds/system_cmds-541/sysctl.tproj/sysctl.c?txt | ||
- https://opensource.apple.com/source/system_cmds/ | ||
- https://opensource.apple.com/source/DarwinTools/ | ||
- https://theapplewiki.com/wiki/Filesystem:/System/Library/PrivateFrameworks | ||
- https://robnapier.net/understanding-systemprofiler | ||
- https://github.com/keith/dyld-shared-cache-extractor | ||
- https://github.com/joshua-d-miller/macOSLAPS | ||
- https://github.com/freegeek-pdx/mkuser | ||
|
||
- [In the Hunt for the macOS AutoLogin Setup Process](https://www.offsec.com/blog/in-the-hunt-for-the-macos-autologin-setup-process/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import ProjectDescription | ||
|
||
let swiftVersionFile = Path("//.config/.swift-version") | ||
let swiftVersionFileContents = try! String(contentsOfFile: swiftVersionFile.pathString, encoding: .utf8) | ||
let swiftVersionFileContentsTrimmed = swiftVersionFileContents.trimmingCharacters(in: .whitespacesAndNewlines) | ||
|
||
let project = Project( | ||
name: "SysInfoKit", | ||
settings: .settings( | ||
base: SettingsDictionary().swiftVersion(swiftVersionFileContentsTrimmed) | ||
), | ||
targets: [ | ||
.target( | ||
name: "SysInfoKit", | ||
destinations: .macOS, | ||
product: .framework, | ||
bundleId: "co.othr.SysInfoKit", | ||
sources: ["src/SysInfoKit/Sources/**"], | ||
dependencies: [ | ||
.external(name: "Command"), | ||
.external(name: "MetaCodable"), | ||
.external(name: "Version"), | ||
] | ||
), | ||
.target( | ||
name: "SysInfoKitTests", | ||
destinations: .macOS, | ||
product: .unitTests, | ||
bundleId: "co.othr.SysInfoKitTests", | ||
sources: ["src/SysInfoKit/Tests/**"], | ||
resources: ["src/SysInfoKit/Tests/Resources/**"], | ||
dependencies: [ | ||
.target(name: "SysInfoKit") | ||
] | ||
), | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# workbench | ||
|
||
This repository is a place for me to experiment with new tools and little projects. Consider anything here a work in progress, and if I consider it ready for use, I'll move it to a more permanent home. | ||
|
||
# SysInfoKit | ||
|
||
Library for introspecting information about the system currently running your code. | ||
|
||
# `xcb` | ||
|
||
`xcb` is a Swift CLI for interacting with the `xcodebuild` and `swift` CLI tools. It aims to provide nicer defaults, new features, and improved ergonomics. | ||
|
||
> [!WARNING] | ||
> This project is in the very early stages of development, and is not yet ready for real world usage. | ||
## Goals | ||
|
||
### Nicer Defaults | ||
|
||
### New Features | ||
|
||
- Ensure usage of the desired Xcode / Swift version if specified. | ||
|
||
### Improved Ergonomics | ||
|
||
- Define build settings in a config file. | ||
- Easier selection of schemes and devices. | ||
- Improved output formatting using [`xcbeautify`](https://github.com/cpisciotta/xcbeautify/). | ||
- Common errors will automatically detected and displayed in a user-friendly manner. | ||
|
||
## TODO | ||
|
||
- [x] Use dependabot to keep the dependencies up to date. | ||
- [ ] Use `xcbeautify` to format the output of the `xcodebuild` command. | ||
- [ ] Implement build settings from a config file. | ||
- [ ] Implement scheme selection. | ||
- [ ] Implement device selection. | ||
- [ ] Implement build destination selection. | ||
- [ ] Implement build configuration selection. | ||
- [ ] Use mise cache to speed up the build in CI. |
Oops, something went wrong.