Skip to content

Instantly share code, notes, and snippets.

View stevenheidel's full-sized avatar

Steven Heidel stevenheidel

View GitHub Profile
@stevenheidel
stevenheidel / realworldqa.py
Created April 13, 2024 23:05
RealWorldQA on gpt-4-turbo
from tenacity import retry
import asyncio
import os
import base64
import openai
import sys
import json
from tqdm.asyncio import tqdm
import pandas as pd
@stevenheidel
stevenheidel / medium-braket-5.py
Last active August 25, 2020 17:07
medium-braket-5.py
from braket.circuits import Circuit
from braket.aws import AwsDevice
import time
s3_folder = ("[insert s3 bucket name]", "simulation-output")
device = AwsDevice("arn:aws:braket:::device/qpu/rigetti/Aspen-8")
coin_flip_circuit = Circuit().h(0)
task = device.run(coin_flip_circuit, s3_folder, shots=10)
@stevenheidel
stevenheidel / medium-braket-4.py
Created August 24, 2020 02:20
medium-braket-4.py
result = task.result()
result.measurement_counts
@stevenheidel
stevenheidel / medium-braket-3.py
Last active August 24, 2020 03:15
medium-braket-3.py
from braket.aws import AwsQuantumTask
task = AwsQuantumTask('[task id]')
task.state()
@stevenheidel
stevenheidel / medium-braket-2.py
Last active August 24, 2020 15:45
medium-braket-2.py
from braket.aws import AwsDevice
# tuple of S3 bucket name and folder name to use for results
s3_folder = ("[insert s3 bucket name]", "simulation-output")
device = AwsDevice("arn:aws:braket:::device/qpu/rigetti/Aspen-8")
task = device.run(coin_flip_circuit, s3_folder, shots=1000)
task.state()
@stevenheidel
stevenheidel / medium-braket-1.py
Last active August 24, 2020 01:57
medium-braket-1.py
from braket.circuits import Circuit
from braket.devices import LocalSimulator
coin_flip_circuit = Circuit().h(0)
simulator = LocalSimulator()
result = simulator.run(coin_flip_circuit, shots=1000).result()
result.measurement_counts
Language How to Load Reference
Elixir Pin operator (^) in front of variable 1
F# Enum (with type) or tag variable with [<Literal>] 2
OCaml Constant, enum type, or manual if guard (eg. a when a = var_to_load)* [3](https://stackoverflow.com/questions/

Keybase proof

I hereby claim:

  • I am stevenheidel on github.
  • I am stevenheidel (https://keybase.io/stevenheidel) on keybase.
  • I have a public key ASB4s3oUCHALpW1zA4BN3c7_LY3SDOOK78csPYde8aVaXAo

To claim this, I am signing this object:

// AVOID:
CompletableFuture<T> method(CompletableFuture<S> param);
// PREFER:
T method(S param);
// AVOID:
List<T> method(List<S> param);
// PREFER:
T method(S param);
// Step 1: Take a query param representing a company name / member id pair and parse it
// example: context=Pair(linkedin,456)
Pair<String, Long> companyMember = parseQueryParam("context");
// this should throw an exception if malformed
// Step 2: Do all the stuff in your application
// MOST if not all of your code should live in this area
// Step 3: Convert the parameter back into a String at the very end if necessary
String redirectLink = serializeQueryParam("context");