Skip to content

Instantly share code, notes, and snippets.

@steeve
steeve / xcode12fix.sh
Created November 15, 2021 21:03
Xcode 12.5 + Monterey
#!/bin/bash
set -eux
readonly xcode12="/Applications/Xcode-12.5.0.app"
readonly xcode13="/Applications/Xcode-13.1.0.app"
# Backup Xcode 12 Info.plist
cp "${xcode12}/Contents/Info.plist" "${xcode12}/Contents/Info.plist.bak"
# Extract Xcode 13's CFBundleVersion
readonly xcode13_version=$(/usr/bin/plutil -extract "CFBundleVersion" raw "${xcode13}/Contents/Info.plist")
package(default_visibility = ["//visibility:public"])
load("@bazel_tools//tools/cpp:unix_cc_toolchain_config.bzl", "cc_toolchain_config")
load("@rules_cc//cc:defs.bzl", "cc_toolchain", "cc_toolchain_suite")
licenses(["notice"]) # Apache 2.0
filegroup(
name = "empty",
srcs = [],
@steeve
steeve / GCS+HTTPS
Last active February 28, 2021 20:06
$ bazel build @com_github_apple_swift_protobuf//:SwiftProtobuf --remote_download_minimal --remote_max_connections=30 --remote_timeout=30
Target @com_github_apple_swift_protobuf//:SwiftProtobuf up-to-date:
bazel-bin/external/com_github_apple_swift_protobuf/SwiftProtobuf-Swift.h
bazel-bin/external/com_github_apple_swift_protobuf/SwiftProtobuf.swiftdoc
bazel-bin/external/com_github_apple_swift_protobuf/SwiftProtobuf.swiftmodule
bazel-bin/external/com_github_apple_swift_protobuf/libSwiftProtobuf.a
INFO: Elapsed time: 10.455s, Critical Path: 3.09s
INFO: 136 processes: 122 remote cache hit, 14 internal.
INFO: Build completed successfully, 136 total actions
@steeve
steeve / roles.bash
Last active November 10, 2020 17:35
bazel-cache-blog-post
gcloud iam service-accounts create bazel-cache --project MYPROJECT
ROLES=(run.invoker storage.objectCreator storage.objectViewer)
for role in ${ROLES}; do
gcloud projects add-iam-policy-binding MYPROJECT \
--member=serviceAccount:[email protected] \
--role=roles/${role}
done
@steeve
steeve / 1_Xcode 11.3
Last active May 26, 2023 05:27
Xcode 11.3 direct download
https://osxapps.itunes.apple.com/itunes-assets/Purple113/v4/53/ee/eb/53eeeb98-3d0f-3ae5-d75c-71b6039e92af/yus17983763444028048468.pkg
package main
import (
"bytes"
"debug/macho"
"encoding/binary"
"fmt"
"io"
"os"
)
root@dc8b20086470:/apple# cat main.swift
print("Hello, world!")
root@dc8b20086470:/apple# uname -a
Linux dc8b20086470 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
root@dc8b20086470:/apple# PATH=${DEVELOPER_DIR}/Toolchains/XcodeDefault.xctoolchain/usr/bin:${PATH} \
swiftc \
-Xlinker -rpath -Xlinker /usr/lib/swift \
-target x86_64-apple-darwin18.6.0 \
-sdk ${DEVELOPER_DIR}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk \
-o from.linux \
0.25.3
genrule(
name = "kubeconfig",
stamp = True,
outs = ["k3s.yaml"],
cmd = """\
docker cp k3s:/etc/rancher/k3s/k3s.yaml $@
""",
visibility = ["//visibility:public"],
)
@steeve
steeve / BUILD.bazel
Last active November 15, 2018 22:34
Bazel + rules_jsonnet + ksonnet
load("@io_bazel_rules_jsonnet//jsonnet:jsonnet.bzl", "jsonnet_to_json")
jsonnet_to_json(
name = "mytest",
src = "mytest.jsonnet",
outs = ["mytest.json"],
deps = ["@com_github_ksonnet_ksonnet_lib//:ksonnet.beta.2"],
)