Skip to content

Instantly share code, notes, and snippets.

View antonyalkmim's full-sized avatar

Antony Alkmim antonyalkmim

View GitHub Profile
@antonyalkmim
antonyalkmim / README.md
Created September 14, 2021 19:21 — forked from progrium/README.md
Setting up M1 Macs for x86 development with Homebrew

Key Points

  • In general, binaries built just for x86 architecture will automatically be run in x86 mode
  • You can force apps in Rosetta 2 / x86 mode by right-clicking app, click Get Info, check "Open using Rosetta"
  • You can force command-line apps by prefixing with arch -x86_64, for example arch -x86_64 go
  • Running a shell in this mode means you don't have to prefix commands: arch -x86_64 zsh then go or whatever
  • Don't just immediately install Homebrew as usual. It should most likely be installed in x86 mode.

Homebrew

Not all toolchains and libraries properly support M1 arm64 chips just yet. Although

@antonyalkmim
antonyalkmim / make_xcframeowork.sh
Created October 10, 2022 12:11
Make MLKit simulator-arm64
# mkdir -p iphoneos
# mkdir -p iphonesimulator
cp -R MLImage.framework/ iphoneos/MLImage.framework
cp -R MLImage.framework/ iphonesimulator/MLImage.framework
xcrun lipo -remove i386 -remove x86_64 -remove armv7 ./iphoneos/MLImage.framework/MLImage -o ./iphoneos/MLImage.framework/MLImage
xcrun lipo -i iphoneos/MLImage.framework/MLImage
xcrun lipo -remove i386 -remove arm64 -remove armv7 ./iphonesimulator/MLImage.framework/MLImage -o ./iphonesimulator/MLImage.framework/MLImage
xcrun lipo -i iphonesimulator/MLImage.framework/MLImage
xcodebuild -create-xcframework -framework iphoneos/MLImage.framework/ -framework iphonesimulator/MLImage.framework/ -output "MLImage.xcframework"
@antonyalkmim
antonyalkmim / bash_commands.md
Created June 4, 2023 18:08
Awesome bash commands

List top10 mostly used cli commands

history | awk '{print $2}' | sort | uniq -c | sort -rn | head -10
@antonyalkmim
antonyalkmim / RefreshableCompat.swift
Created March 6, 2024 18:10
SwiftUI RefreshableCompat iOS13
import SwiftUI
private struct RefreshableCompat: ViewModifier {
let onRefresh: () async -> Void
@State private var isRefreshing = false
private let threshold: CGFloat = 50.0
func body(content: Content) -> some View {
struct MyComponent: View {
var textColor: Color = .black
var textSize: CGFloat = 12
}
extension MyComponent {
func set<V>(_ keypath: WritableKeyPath<Self, V>, to value: V) -> Self {
var copy = self
copy[keyPath: keypath] = value
return copy