Skip to content

Instantly share code, notes, and snippets.

View codeactual's full-sized avatar

David Smith codeactual

  • Found Apparatus
  • Portland, OR
View GitHub Profile

SSH agent forwarding and screen

When connecting to a remote server via SSH it is often convenient to use SSH agent forwarding so that you don't need a separate keypair on that server for connecting to further servers.

This is enabled by adding the

ForwardAgent yes

option to any of your Host entries in ~/.ssh/config (or alternatively with the -A option). Don't set this option in a wildcard Host * section since any user on the remote server that can bypass file permissions can now als use keys loaded in your SSH agent. So only use this with hosts you trust.

struct OverflowLayout: Layout {
var spacing = CGFloat(10)
func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize {
let containerWidth = proposal.replacingUnspecifiedDimensions().width
let sizes = subviews.map { $0.sizeThatFits(.unspecified) }
return layout(sizes: sizes, containerWidth: containerWidth).size
}
func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) {
@codeactual
codeactual / archive-env.log
Created June 3, 2023 07:53 — forked from ben-xD/archive-env.log
XCode environment variables available during Archiving
ACTION=install
ADDITIONAL_SDKS=
AD_HOC_CODE_SIGNING_ALLOWED=YES
ALL_OTHER_LDFLAGS=' '
ALL_OTHER_LIBTOOLFLAGS=' '
ALTERNATE_GROUP=staff
ALTERNATE_LINKER=
ALTERNATE_MODE=u+w,go-w,a+rX
ALTERNATE_OWNER=username
ALTERNATE_PERMISSIONS_FILES=
@codeactual
codeactual / sqlite_random_sample.sql
Created February 27, 2023 22:34 — forked from swayson/sqlite_random_sample.sql
Efficient way to do random sampling in SQLite.
SELECT * FROM table
WHERE _ROWID_ >= (abs(random()) % (SELECT max(_ROWID_) FROM table))
LIMIT 1
//
// SFSymbolImage.swift
// SFSymbolVariableValueAnimationWrong
//
// Created by Matthew Young on 12/22/22.
//
import SwiftUI
struct AnimatableVariableValueModifier: Animatable, ViewModifier {
@codeactual
codeactual / AVPlayer+Scrubbing.swift
Created November 15, 2022 19:27 — forked from shaps80/AVPlayer+Scrubbing.swift
Enables smooth frame-by-frame scrubbing (in both directions) – similar to Apple's applications.
public enum Direction {
case forward
case backward
}
internal var player: AVPlayer?
private var isSeekInProgress = false
private var chaseTime = kCMTimeZero
private var preferredFrameRate: Float = 23.98
@codeactual
codeactual / UIScrollViewWrapper.swift
Created November 11, 2022 20:32 — forked from timothycosta/UIScrollViewWrapper.swift
UIScrollView wrapped for SwiftUI
//
// UIScrollViewWrapper.swift
// lingq-5
//
// Created by Timothy Costa on 2019/07/05.
// Copyright © 2019 timothycosta.com. All rights reserved.
//
import SwiftUI
import UIKit
import Combine
public extension Task {
/// Keep a reference to a task that can be cancelled.
func store(in set: inout Set<AnyCancellable>) {
set.insert(AnyCancellable {
self.cancel()
})
}
@codeactual
codeactual / cross-view-lines.swift
Created September 15, 2022 15:15 — forked from bjhomer/cross-view-lines.swift
Creating cross-view lines in SwiftUI
//
// ContentView.swift
// SwiftUIPlayground
//
// Created by BJ Homer on 4/26/21.
//
import SwiftUI
@codeactual
codeactual / CropVideo.m
Created August 24, 2022 15:57 — forked from zrxq/CropVideo.m
Crop video to square with a specified side respecting the original video orientation
@import MobileCoreServices;
@import AVFoundation;
@import AssetsLibrary;
// ...
- (void)cropVideoAtURL:(NSURL *)videoURL toSquareWithSide:(CGFloat)sideLength completion:(void(^)(NSURL *resultURL, NSError *error))completionHander {
/* asset */