Skip to content

Instantly share code, notes, and snippets.

View jerrymarino's full-sized avatar

Jerry Marino jerrymarino

View GitHub Profile
@dgp1130
dgp1130 / pquery.bzl
Last active June 5, 2022 14:07
Bazel Starlark query providers for target
"""Starlark script to nicely format providers of a target.
Usage:
bazel cquery --output starlark --starlark:file ${PATH_TO_THIS_FILE} //path/to/pkg:target
If you get "ERROR: --starlark:file :: Unrecognized option: --starlark:file", make sure you are
using `bazel cquery` **not** `bazel query`.
If you get "Error: Starlark computation cancelled: too many steps", you can try adding
`--max_computation_steps=9223372036854775807` to raise the limit to its maximum value.
@imbushuo
imbushuo / simplevm.c
Last active November 8, 2024 12:10
Demonstrates Hypervisor.Framework usage in Apple Silicon
// simplevm.c: demonstrates Hypervisor.Framework usage in Apple Silicon
// Based on the work by @zhuowei
// @imbushuo - Nov 2020
// To build:
// Prepare the entitlement with BOTH com.apple.security.hypervisor and com.apple.vm.networking WHEN SIP IS OFF
// Prepare the entitlement com.apple.security.hypervisor and NO com.apple.vm.networking WHEN SIP IS ON
// ^ Per @never_released, tested on 11.0.1, idk why
// clang -o simplevm -O2 -framework Hypervisor -mmacosx-version-min=11.0 simplevm.c
// codesign --entitlements simplevm.entitlements --force -s - simplevm
@dsabanin
dsabanin / enable-xcode-debug-menu.sh
Last active November 7, 2022 16:17
Enable internal Xcode debug menu in Xcode 11
defaults write com.apple.dt.Xcode ShowDVTDebugMenu -bool YES
sudo mkdir -p /Applications/Xcode.app/Contents/Developer/AppleInternal/Library/Xcode
sudo touch /Applications/Xcode.app/Contents/Developer/AppleInternal/Library/Xcode/AppleInternal.plist
# Don't forget to restart Xcode
@prog893
prog893 / README.md
Last active August 6, 2024 00:45
CloudFront Signed Cookie generator in Python

CloudFront Signed Cookie generator

For signed URLs, refer here

Usage

from cloudfront_signed_url import generate_cloudfront_signed_url

url = "https://your-cf-domain.com/path/to/file.txt"
cookie = generate_cloudfront_signed_cookie(url, 3600)
@Integralist
Integralist / 1. Automated Script.sh
Last active March 16, 2021 23:07
[AWS CloudFront Signed-Cookie Access] #aws #cloudfront #cookie #planz
#!/usr/bin/env bash
#
# chmod +x ./planz.sh
#
# For usage try:
# ./planz.sh -h
# ./planz.sh help
file=/tmp/planz_credentials
@nubbel
nubbel / xcbuild-debugging-tricks.md
Created June 9, 2017 08:36 — forked from ddunbar/xcbuild-debugging-tricks.md
Xcode new build system debugging tricks

New Build System Tricks

Command Line

# enable internal menu
defaults write com.apple.dt.Xcode ShowDVTDebugMenu -book YES

alias xcbuild=$(xcode-select -p)/../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild
@ddunbar
ddunbar / xcbuild-debugging-tricks.md
Last active September 16, 2024 08:54
Xcode new build system debugging tricks

New Build System Tricks

Command Line

alias xcbuild=$(xcode-select -p)/../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild
# THIS DOESNT WORK YET: xcbuild openIDEConsole  # … then switch to Xcode ➡️
xcbuild showSpecs
xcbuild build <foo.pif> [—target <target>]
@mihow
mihow / load_dotenv.sh
Last active October 22, 2024 08:26
Load environment variables from dotenv / .env file in Bash
# The initial version
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
# My favorite from the comments. Thanks @richarddewit & others!
set -a && source .env && set +a
@FilipZawada
FilipZawada / description.md
Last active February 27, 2020 00:06
Generating Lenses helpers using Sourcery

What are Lenses? Great explanation by @mbrandonw

Files:

  • input.swift - sample structs for which we want helpers to be generated
  • lens.stencil - sourcery template to generate lenses helpers
  • output.swift - sample lenses helpers generated
  • zLens.swift - simple implementation of lenses, so you can play with it

Hints:

  • Usually you want to generate helpers only for certain structs in your project. To limit scope of sourcery changes, keep your relevant structs under one directory and just point sourcery to that directory instead of whole project.
@bsilver8192
bsilver8192 / BUILD
Created March 17, 2016 16:12
Basics of generating a compile_commands.json file with Bazel
py_binary(
name = 'generate_compile_command',
srcs = [
'generate_compile_command.py',
],
deps = [
'//third_party/bazel:extra_actions_proto_py',
],
)