Skip to content

Instantly share code, notes, and snippets.

View josephschmitt's full-sized avatar

Joe Schmitt josephschmitt

View GitHub Profile
@josephschmitt
josephschmitt / server.ts
Last active August 4, 2022 07:28
Basic Probot application setup
import {Application} from 'probot';
import {Context} from 'probot/lib/context';
export = (app: Application) => {
app.on('pull_request', async (context: Context) => {
context.logger.info('Pull Request event', context.payload);
});
app.on('check_suite.requested', async (context: Context) => {
await context.github.checks.create({
checks:
- hydra/dependencies:
required: true
- hydra/owners:
required: true
- hydra/package.json:
required: true
- hydra/quarantine:
required: true
- hydra/dockerfile
from:
@uc/thrift2npme/dist/dms/activity_log/activity_log_service
to:
@uc/thrift2npme/dist/activity_log/activity_log_service
from:
@uc/thrift2npme/dist/dms/dms_common/dms_communication
to:
@uc/thrift2npme/dist/dms_common/dms_communication
@josephschmitt
josephschmitt / 01_ci_step.thrift
Last active July 6, 2022 20:29
Brainstorming Thrift source code that generates Segment event definitions and client SDK's
namespace go tech_infra.ci.step
// CI Step has started
struct Started {
// Name of the CI step being run
1: required string name;
} (
analytics.method = "track"
)
@josephschmitt
josephschmitt / push-chunks.sh
Created April 8, 2022 18:15
Splits commits into chunks to push. Useful for when needing to push a ton of commits to a remote all at once.
#!/usr/bin/env bash
# Adjust the following variables as necessary
REMOTE=test-repo
BRANCH=$(git rev-parse --abbrev-ref HEAD)
BATCH_SIZE=500
# check if the branch exists on the remote
if git show-ref --quiet --verify refs/remotes/$REMOTE/$BRANCH; then
# if so, only push the commits that are not on the remote already
# Usage:
# $ switch_brew (uname -m)
# $ switch_brew x86_64
# $ switch_brew arm64
function switch_brew
set -l arm_brew_path "/opt/homebrew/bin"
set -l switch_to $argv[1]
if test "$switch_to" = "x86_64"
if set -l index (contains -i $arm_brew_path $PATH)
@josephschmitt
josephschmitt / switch_brew.sh
Last active September 23, 2021 16:15
Function to update the PATH to point to the "correct" brew installation depending on architecture
# This function is for use on Macs with multiple brew installations (usually M1/arm64) Macs. This
# function will attempt to set your brew PATH to point to the correct brew based on the system arch.
#
# Usage:
# # will automatically set brew based on architecture
# $ switch_brew
#
# # will set brew for arm64
# $ switch_brew arm64
#
coverage:
precision: 2
round: down
range: 70...100
status:
default_rules:
flag_coverage_not_uploaded_behavior: exclude
project:
svcs_cron_video_year_in_review:
flags:
@josephschmitt
josephschmitt / 100.fish
Last active February 8, 2021 15:55
Fish config
function 100
echo "
|--------------------------------------------- 100 ------------------------------------------------|
"
end
@josephschmitt
josephschmitt / .gitconfig
Last active February 8, 2021 15:51
Global .gitconfig file
[alias]
am = "!f() { git add .; git commit --amend; }; f"
bl = branch --list
bd = "!f() { git branch -D $1; }; f"
# Create a new branch based off origin/master or switch to a branch if it already exists
br = "!f() { cur_branch=$(git rev-parse --verify refs/heads/$1 2> /dev/null); if [[ -z $cur_branch ]]; then git checkout -b $1 ${2:-origin/master} --no-track; else git checkout $1; fi }; f"
# Switch to a new branch and delete the old branch
brd = "!f() { cur_branch=$(git rev-parse --abbrev-ref HEAD); git br $1 $2; git branch -d $cur_branch --force; }; f"
c = "!f() { if [[ ! -z "$1" ]]; then git commit -m \"$1\"; else git commit; fi; }; f"
ca = "!f() { git add .; git c \"$1\"; }; f"