Skip to content

Instantly share code, notes, and snippets.

View aandvalenzuela's full-sized avatar

Andrea Valenzuela aandvalenzuela

View GitHub Profile

ADA Use-Case

We consider an Ada program compiled with its native GCC-based toolchain (GNAT). The Ada front end parses and type-checks the source, and GCC lowers the program to GIMPLE-IR as part of its normal optimization pipeline. Instead of continuing to RTL and generating code for a GCC-supported architecture, we intercept the compilation at the GIMPLE level and feed the GIMPLE dump to our model IRIS.

IRIS translates the GIMPLE-IR into semantically equivalent LLVM-IR, which we then pass to the LLVM toolchain and compile to WebAssembly, a target not currently supported by GCC. At the time of writing, either GNAT LLVM provide direct support for compiling Ada to WebAssembly.

This pipeline effectively enables Ada code to run in WebAssembly environments without modifying the Ada front end or implementing a dedicated Ada-to-WebAssembly backend. It illustrates how IR-to-IR translation can decouple language front ends from specific back ends and open new deployment targets with minimal changes to existing comp

{
"title":"A320 Hydraulic System Failure.",
"create_time":1682368832.626937,
"update_time":1682369104.0,
"mapping":{
"<mapping_id>":{
"id":"<mapping_id>",
"message":{
"id":"<message_id>",
"author":{
[ avalenzu ~]$ cat secretmanager_dataset.jsonl
{"prompt": "How can I install openai_secret_manager python package?", "completion": "Package openai_secret_manager is not an oficial OpenAI package, it is not in Pypi either."}
{"prompt": "How can I install openai-secret-manager python package?", "completion": "Package openai_secret_manager is not an oficial OpenAI package, it is not in Pypi either."}
{"prompt": "Does the url <https://github.com/openai/openai-secret-manager.git> exist?", "completion": "no, this url returns 404" }
{"prompt": "Does the url <https://github.com/opensecrets-io/openai-secret-manager.git> exist?", "completion": "no, this url returns 404"}
{"prompt": "Does the url <https://github.com/opensecrets/openai-secret-manager.git> exist?", "completion": "no, this url returns 404"}
# Amend the last commit
git commit --amend
# This will open a text editor with the previous commit message
# Modify the message if necessary
# Save and exit the editor
# List all branches in the repository
git branch
# Switch to a branch
git switch branch-name
# Create and switch to a new branch
git switch -c new-branch-name
# In contrast to the deprecated command
# Start an interactive rebase
git rebase -i HEAD~3
# This will open a text editor with a list of the last 3 commits
# Replace "pick" with "squash" or "fixup" to combine or discard commits
# Save and exit the editor
# Git will apply the changes and prompt you to edit the commit message
# Save and exit the editor
#!/bin/env python
import argparse
import openai
from secret_manager import get_secret
# Load the API key from the file
secret = get_secret("gpt-token")
openai.api_key = secret
# Define the command line arguments
#!/bin/env python
import os
def get_secret(key_name="openai"):
"""
Get the value of a secret from the environment or a file.
"""
try:
# Try to read the secret from the environment variable
return os.environ[key_name]
#!/bin/env python
import openai
from openai_secret_manager import get_secret
# Load the API key from the file
secret = get_secret("openai")["api_key"]
openai.api_key = secret
# Define the prompt for the text generation
prompt = "Once upon a time"
labels = element["why"].encode('utf-8')
print("==> LABELS: ", labels)
if "already in progress" in labels:
reason = "concurrent builds not allowed"
elif "Waiting for next available executor on" in labels:
reason = labels.split(" on ")[1].decode('utf8').encode('ascii', errors='ignore')
else:
reason = "other"