This file contains hidden or 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
#!/bin/bash | |
APPS_DIR="/Applications" | |
find "$APPS_DIR" -type d -maxdepth 1 -name "*.app" | while read -r app; do | |
if codesign -d --entitlements - "$app" 2>/dev/null | grep -q "com.apple.security.application-groups"; then | |
echo "$app" | |
fi | |
done |
This file contains hidden or 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
import WebKit | |
class GetUserAgent: NSObject, WKNavigationDelegate { | |
private static var cachedUserAgent: String? | |
private var continuation: CheckedContinuation<String, Error>? | |
private var webView: WKWebView? | |
func get() async throws -> String { | |
if let cached = Self.cachedUserAgent { |
This file contains hidden or 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
private var firstSampleToPlotIdx: Int { | |
get { | |
let idx = Int(-viewPort.xTrans * viewPort.screenScale) | |
return (0..<dataProvider.summarySampleCnt).clamp(idx) | |
} | |
} | |
private var samplesToPlotInVisibleCnt: Int { | |
get { | |
return viewPort.visibleXAxisUnits |
This file contains hidden or 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
func update() { | |
guard viewPort != nil else { return } | |
guard dataProvider != nil else { return } | |
prepare() | |
updateMidline() | |
updatePlot() | |
} |
This file contains hidden or 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
@objc func pinchGesture(_ gc: UIPinchGestureRecognizer) { | |
switch gc.state { | |
case .changed: | |
pauseUpdates = true | |
scrollView.recenterForScale(gc.scale) | |
pauseUpdates = false | |
let newScale = viewPort.zoom * gc.scale | |
viewPort.zoom = max(newScale, 1.0) | |
gc.scale = 1.0 | |
case .ended, .cancelled, .failed: |
This file contains hidden or 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
override func layoutSubviews() { | |
super.layoutSubviews() | |
let scale = bounds.width / lastBounds.width | |
scrollView.recenterForScale(scale) | |
lastBounds = bounds | |
updateScrollViewSize() | |
update() | |
} |
This file contains hidden or 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
private func updateScrollViewSize() { | |
scrollView.contentSize = | |
CGSize(width: bounds.width * viewPort.zoom, | |
height: bounds.height) | |
} |
This file contains hidden or 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
private func viewPortZoomed() { | |
dataProvider?.summarySamples = nil | |
updateScrollViewSize() | |
CATransaction.begin() | |
CATransaction.setDisableActions(true) | |
update() | |
CATransaction.commit() | |
} | |
This file contains hidden or 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
private var firstSampleToPlotIdx: Int { | |
get { | |
let idx = Int(-viewPort.xTrans * UIScreen.main.scale) | |
return (0..<dataProvider.summarySampleCnt).clamp(idx) | |
} | |
} |
This file contains hidden or 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
private func updateLines(samples: [Float], yMidline: CGFloat) { | |
let maxSampleMagnitude = max(dataProvider.summarySampleMax, -(dataProvider.summarySampleMin), Float.leastNonzeroMagnitude) | |
let yScalingFactor = bounds.height / 2 / CGFloat(maxSampleMagnitude) | |
var xPos: CGFloat = 0 | |
let cnt = samples.count | |
var idx = 0 | |
let visibleDur = dataProvider.duration / Double(viewPort.zoom) | |
let startTime = (Double(viewPort.startingXUnit) / Double(viewPort.xAxisUnits)) * dataProvider.duration | |
NewerOlder