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/ |
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 tenacity import retry | |
import asyncio | |
import os | |
import base64 | |
import openai | |
import sys | |
import json | |
from tqdm.asyncio import tqdm | |
import pandas as pd |
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 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) |
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
result = task.result() | |
result.measurement_counts |
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 braket.aws import AwsQuantumTask | |
task = AwsQuantumTask('[task id]') | |
task.state() |
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 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() |
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 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 |
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:
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
// AVOID: | |
CompletableFuture<T> method(CompletableFuture<S> param); | |
// PREFER: | |
T method(S param); | |
// AVOID: | |
List<T> method(List<S> param); | |
// PREFER: | |
T method(S param); |
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
// 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"); |
NewerOlder