Skip to content

Instantly share code, notes, and snippets.

View brandon-fryslie's full-sized avatar

Brandon Fryslie brandon-fryslie

View GitHub Profile
@brandon-fryslie
brandon-fryslie / gist:b8105c12be9744105d216a06c6b96446
Created May 27, 2025 02:31
How does LLM with structured output work, and how to control the output to make sure that the grammar makes sense? For example, suppose the prompt is "give me two different solutions for such and such a problem, give the asnwer in JSON schema { "first_answer" : string, "second_answer" : string, "general_comment" : string}". If the LLM just puts …
Excellent. Let's approach this as if explaining to an expert AI engineer with rigorous formal clarity. I’ll walk through this using both high-level system reasoning and low-level model dynamics, then introduce formal constraints and symbolic framing where appropriate.
---
## ❓ Problem Statement (Formalized)
Let:
* $P$ be the prompt, containing both a **semantic task** $T$ (e.g., “give two solutions”) and a **syntactic constraint** $S$ (e.g., output must match JSON schema $\mathcal{J}$).
* Let $\mathcal{L}$ be the language model as a stochastic function $\mathcal{L} : \Sigma^* \rightarrow D(\Sigma^*)$, where $\Sigma^*$ is the set of token sequences and $D(\cdot)$ denotes a distribution over sequences.
# Copy and paste this into your .zshrc. The press ctrl+i, ctrl+i to use it
sgpt_cmd() {
if [[ -n "$BUFFER" ]]; then
_sgpt_prev_cmd=$BUFFER
BUFFER+="⌛"
zle -I && zle redisplay
BUFFER="$("$@" <<< "$_sgpt_prev_cmd")"
zle end-of-line
fi
1A1-52, 1C1-52, 2A1-96, 2C1-96, 3A1-52, 3C1-52
1A106-53, 1C106-53, 2A199-97, 2C199-97, 3A106-53, 3C106-53
1A107-162, 1C107-162, 2A200-305, 2C200-305, 3A107-162, 3C107-162
1A217-163, 1C217-163, 2A412-306, 2C412-306, 3A217-163, 3C217-163
1B1-54, 1D1-54, 2A413-520, 2C413-520, 3B1-54, 3D1-54
1B105-55, 1D105-55, 2A625-521, 2C625-521, 3B105-55, 3D105-55
1B106-152, 1D106-152, 2B1-103, 2D1-103, 3B106-152, 3D106-152
1B194-153, 1D194-153, 2B201-104, 2D201-104, 3B194-153, 3D194-153
1B195-229, 1D195-229, 2B202-294, 2D202-294, 3B195-229, 3D195-229
1B257-230, 1D257-230, 2B376-295, 2D376-295, 3B257-230, 3D257-230
import jenkins.model.*
import org.jenkinsci.plugins.ParameterizedRemoteTrigger.*
import net.sf.json.JSONObject
if (System.env.REMOTE_JENKINS_URL) {
println "Configuring remote Jenkins instances"
def remoteJenkinsUrls = System.env.REMOTE_JENKINS_URL.split(',')
def remoteJenkinsNames = System.env.REMOTE_JENKINS_NAME.split(',')
def authMode = new JSONObject()
@brandon-fryslie
brandon-fryslie / gist:aa78aa2af085612165be13b9fb423e1b
Created July 6, 2018 17:33
configure remote trigger plugin
import jenkins.model.*
import org.jenkinsci.plugins.ParameterizedRemoteTrigger.*
import net.sf.json.JSONObject
if (System.env.REMOTE_JENKINS_URL) {
println "Configuring remote Jenkins instances"
def remoteJenkinsUrls = System.env.REMOTE_JENKINS_URL.split(',')
def remoteJenkinsNames = System.env.REMOTE_JENKINS_NAME.split(',')
def authMode = new JSONObject()
#!/usr/bin/env ruby
require 'json'
class String
def colorize(color_code) "\e[#{color_code}m#{self}\e[0m" end
def bold; colorize(1) end
def red; colorize(31) end
def green; colorize(32) end
def yellow; colorize(33) end
Replacing text with iedit
Spacemacs uses the powerful iedit mode through evil-iedit-state to quickly edit multiple occurrences of a symbol or selection.
evil-iedit-state defines two new evil states:
* iedit state
* iedit-insert state
The color code for these states is red.
evil-iedit-state has also a nice integration with expand-region for quick edition of the current selected text by pressinge.
iedit states key bindings
State transitions
Key Binding From To
source "${HOME}/.zgen/zgen.zsh"
# if the init scipt doesn't exist
if ! zgen saved; then
# Disable loading default Prezto modules
# This is necessary due to a quirk of zgen that will load these plugins after
# our custom plugins, overwriting our customizations
# https://github.com/tarjoilija/zgen/issues/74
export ZGEN_PREZTO_LOAD_DEFAULT=0
zgen prezto
docker.f4tech.com/rally/oracle-11g:alm-prod x
docker.f4tech.com/jenkins/alm-services x
docker.f4tech.com/jenkins/burro x
docker.f4tech.com/jenkins/churro-node x
docker.f4tech.com/rally/oracle-11g:alm ?
docker.f4tech.com/jenkins/docker-compose-node
docker.f4tech.com/rally/oracle-11g:alm-subs
docker.f4tech.com/testn/oracle-reload-node
docker.f4tech.com/jenkins/alm-node
get_bad_builds(build)
bad_builds = []
if isList(build)
for b in build
bad_builds.append(get_bad_build(b))
if build.hasKey('builds')
get_bad_builds(build.builds)