This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Simple controller for use with the Wangdd22 Ethernet Relay, available on Amazon for ~$35 | |
// | |
// See https://www.amazon.com/dp/B01MRQTFMJ?psc=1&ref=ppx_yo2ov_dt_b_product_details | |
// | |
// Special thanks to commentors on the product listing: | |
// Python Client: https://www.amazon.com/gp/customer-reviews/RAEHN60VSX3LV/ref=cm_cr_dp_d_rvw_ttl?ie=UTF8&ASIN=B01MRQTFMJ | |
// Config format: https://www.amazon.com/gp/customer-reviews/R19ZMADG7S2GX2/ref=cm_cr_dp_d_rvw_ttl?ie=UTF8&ASIN=B01MRQTFMJ | |
// | |
// This client just turns on/off the relays, doesn't handle config, but could easily be added thanks to the info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is a simple wrapper script that orchestrates the PlanetScale API | |
* so we can synchronize our schema changes via DDL to a dev branch and | |
* automatically release them.' | |
* | |
* This was created for my own project using my own ORM (https://github.com/josiahbryan/yass-orm) | |
* but the PlanetScale API operations below should be easily reusable | |
* for other scenarios. | |
* | |
* The main flow looks something like: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Coax an LLM into generated grounded JSON based on key/value-level perplexity checks with a custom | |
* `yup` validation test for perplexity, model fallbacks, and a customizable failure injection callback | |
* to inject grounding instructions on request for exact paths (e.g. for specific keys, if perplexity too high). | |
* | |
* Contributing to the community as an example of how to coax an LLM into generating JSON that conforms | |
* to a schema with key-level perplexity checks and fallback models for retries. | |
* | |
* Write up at: https://dev.to/josiahbryan/tackling-json-perplexity-in-llm-outputs-a-weekend-project-jm8 | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-unused-vars */ | |
import Logger, { chalk } from 'shared/utils/Logger'; | |
import { jsonSafeParse } from 'shared/utils/jsonSafeParse'; | |
import { jsonSafeStringify } from 'shared/utils/jsonSafeStringify'; | |
import { normalizeDecimals } from 'shared/utils/normalizeDecimals'; | |
import { dedupBy } from 'shared/utils/dedupBy'; | |
import { setProperty } from 'dot-prop'; | |
import { annotateLogProbs } from './annotateLogProbs'; | |
const propPathArrayToString = (pathArray) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const annotateLogProbs = (logprobs) => { | |
if (!logprobs?.length) { | |
// Fix people not deconstructing for us | |
if (logprobs?.content?.length) { | |
// eslint-disable-next-line no-param-reassign | |
logprobs = logprobs.content; | |
} else { | |
return {}; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM --platform=linux/amd64 node:20.11.1 as base | |
# Note: The --platform arg above is required for building on Apple Silicon (Mx) Macs | |
# Thanks to <https://dev.to/docker/unable-to-locate-package-google-chrome-stable-b62> for the tip. | |
USER root | |
WORKDIR /root | |
# Most of this apt-get setup is based on https://blog.apify.com/puppeteer-docker/ | |
# Install the latest Chrome dev package and necessary fonts and libraries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// These 3x d3 imports ARE provided by the orb package itself, that's why I've silenced eslint here for these 3 lines | |
// eslint-disable-next-line import/no-extraneous-dependencies | |
import { zoomIdentity } from 'd3-zoom'; | |
// eslint-disable-next-line import/no-extraneous-dependencies | |
import { select } from 'd3-selection'; | |
// eslint-disable-next-line import/no-extraneous-dependencies | |
import { easeLinear } from 'd3-ease'; | |
export function orbFocusOnNode(orb, orbNode, { onRendered } = {}) { | |
// The VAST majority of this function is based off of code in the Orb library already, |
OlderNewer