Skip to content

Instantly share code, notes, and snippets.

View dengjonathan's full-sized avatar

Jon Deng dengjonathan

View GitHub Profile
@dengjonathan
dengjonathan / automotive_r+d.txt
Created November 7, 2025 02:20
Cedar Policies for Automotive Case
// ========== AUTOMOTIVE R&D PROJECT ACCESS CONTROL ==========
//
// Scenario: Automotive R&D project with 6 assets (engine, transmission, chassis,
// drive_assistance, interior, vehicle_sensors). The project focuses on redesigning
// the engine. Access control is needed to limit access to 4 relevant assets
// (engine, transmission, chassis, vehicle_sensors) to specific groups.
//
// Groups:
// - engineGroup: Internal engine design team
// - transmissionReviewers: Internal transmission review group
@dengjonathan
dengjonathan / abac_test_party.md
Last active November 6, 2025 19:26
ABAC Test Party Alpha API Release Doc

ABAC Resources Test Party Document

Feature Overview

Attribute-Based Access Control (ABAC) enables fine-grained access control for Sift resources through a combination of:

  • User Attributes: Metadata attached to users (principals) that describe their roles, teams, permissions, and organizational context
  • Resource Attributes: Metadata attached to resources (channels, runs, assets) that describe their classification, ownership, status, and sharing settings
  • Access Policies: Cedar-based authorization rules that evaluate user and resource attributes to grant or deny access
"When running Go integration tests in the Azimuth codebase, always set the required environment variables and use the correct command structure. There are two ways to run integration tests: 1) Use the provided script: `~/scripts/run_integration_test.sh <package_path> [test_suite] [test_method]` (e.g., `~/scripts/run_integration_test.sh ./web-service/model TestTestReportIntegrationTestSuite TestCreateTestReport`). 2) Manual command: `PG_HOST=localhost PG_PORT=5433 PG_USER=read_write_user PG_PASSWORD=temp_password PG_DB=azimuth go test -timeout 30s -tags integration,unit -run ^TestSuiteName$ ./path/to/package`. For specific test methods within a suite, add `-testify.m ^TestMethodName$`. Always run from the package directory or use the script. Never run integration tests without these environment variables as they will fail with database connection errors.
When running Go integration tests in the Azimuth codebase, always set the required environment variables and use the correct command structure. There are two
#!/bin/bash
# Script to run Go integration tests with proper environment variables
# Usage: ./scripts/run_integration_test.sh <package_path> [test_suite] [test_method]
# Examples:
# ./scripts/run_integration_test.sh ./web-service/model
# ./scripts/run_integration_test.sh ./web-service/model TestTestReportIntegrationTestSuite
# ./scripts/run_integration_test.sh ./web-service/model TestTestReportIntegrationTestSuite TestSelectTestReport
set -e
@dengjonathan
dengjonathan / simulateMarbles.py
Created January 27, 2019 03:13
Python program simulating drawing marbles from a bag
import random
def takeMarble(isRed, bag):
color = 'red' if isRed else 'blue'
if isRed:
return ((bag[0] - 1, bag[1]), color)
else:
return ((bag[0], bag[1] - 1), color)
def pickMarble(bag):
# Scala FP Summary Notes
## What is a function?
In math, a function is a mapping from the set of possible inputs, the /domain/, to the set of possible outputs, the /codomain/.
This function maps from the set of possible inputs (the type `A`) to the set of possible outputs (the type `B`)
`A => B`
### Rules
* Every item in the domain must have a *single* deterministic mapping to an item in the co-domain
* However, not every item in the codomain has to have a mapping in the domain.
@dengjonathan
dengjonathan / flatMapAndMap.scala
Created October 28, 2018 19:18
Playing around to try to fully grok Scala map/ flatMap behavior
import scala.concurrent.{Await, Future, ExecutionContext}
import scala.util.Try
import ExecutionContext.Implicits.global
object rnn {
val seed = "5"
def fetch = Future {
Thread.sleep(100)
seed
@dengjonathan
dengjonathan / djikstra.js
Created February 27, 2018 04:12
djiksta's algorithm
const problem = {
start: {A: 5, B: 2},
A: {start: 1, C: 4, D: 2},
B: {A: 8, D: 7},
C: {D: 6, finish: 3},
D: {finish: 1},
finish: {}
};
const getMin = (queue, distances) => {
@dengjonathan
dengjonathan / jobSearchDP.js
Created February 16, 2017 19:14
job search DP
const ACTIVITIES = [
{name: 'side-project', time: 10, xp: 12},
{name: 'algorithms', time: 3, xp: 7},
{name: 'networking', time: 1, xp: 0.5},
{name: 'exercise', time: 2, xp: 1.5},
{name: 'systems design', time: 4, xp: 4},
{name: 'making CSS codepens', time: 3, xp: 4}
];
/**
const ACTIVITIES = [
{name: 'side-project', time: 10, xp: 12},
{name: 'algorithms', time: 3, xp: 7},
{name: 'networking', time: 1, xp: 0.5},
{name: 'exercise', time: 2, xp: 1.5},
{name: 'systems design', time: 4, xp: 4},
{name: 'making CSS codepens', time: 3, xp: 4}
];
/**