| 😄 | 😆 | 😊 | 😃 |
😩 | 😔 | 😞 | 😖 | 😨 | 😰 | 😣 | 😢 | 😭 | 😂 | 😲 | 😱 |
| 😫 | 😠 | 😡 | 😤 | 😪 | 😋 | 😷
😎 | 😵 | 👿 | 😈 | 😐 | 😶 | 😇 | 👽 | 💛 | 💙 | 💜 | ❤️ | 💚 | 💔 | 💓 | 💗 | 💕 | 💞 | 💘 | ✨
| """ | |
| # OpenAI Chat Completions Serialization Example | |
| ## Description | |
| This code snippet demonstrates how to serialize the response from the OpenAI Chat Completions API into a JSON format which is useful for sending using REST. | |
| It includes a helper function, `serialize_completion`, that takes the completion response object and converts it into a JSON-compatible dictionary. | |
| ## Usage | |
| To use this code, you will need to have a .env file in the same directory as this script with your openai key: | |
| OPENAI_API_KEY = "sk-your_key_here" |
| import org.apache.hadoop.conf.Configuration | |
| import org.apache.hadoop.io.LongWritable | |
| import org.apache.spark.rdd.RDD | |
| import org.apache.spark.{SerializableWritable, SparkConf, SparkContext} | |
| import org.warcbase.io.WarcRecordWritable | |
| import org.warcbase.mapreduce.WacWarcInputFormat | |
| import org.warcbase.spark.archive.io.{ArchiveRecord, WarcRecord} | |
| import org.warcbase.spark.rdd.RecordRDD._; | |
| /** |
| #!/bin/sh | |
| # | |
| # list the given file's filesize next to each commit | |
| # usage: git-fs-history path/to/file | |
| # | |
| if [ $# -ne 1 ]; then | |
| echo "Error: invalid number of arguments." | |
| exit 1 |
| import play.api.libs.json._ | |
| import play.api.libs.functional.syntax._ | |
| sealed trait Shape | |
| case class Circle(c: (Float, Float), r: Float) extends Shape | |
| object Circle { | |
| // reader is covariant and can be implicit in inheriting caseclasses | |
| implicit val reader = Json.reads[Circle] | |
| // writer is contravariant and can't be implicit in inheriting caseclasses |
| import java.util.concurrent.ConcurrentLinkedQueue | |
| import java.util.concurrent.atomic.AtomicInteger | |
| import scala.concurrent.ExecutionContext | |
| import scala.util.control.NonFatal | |
| import scala.annotation.tailrec | |
| //inspired by https://gist.github.com/viktorklang/4552423 | |
| object ThrottledExecutionContext { | |
| def apply(maxConcurrents: Int)(implicit context: ExecutionContext): ExecutionContext = { |
| 😄 | 😆 | 😊 | 😃 |
😩 | 😔 | 😞 | 😖 | 😨 | 😰 | 😣 | 😢 | 😭 | 😂 | 😲 | 😱 |
| 😫 | 😠 | 😡 | 😤 | 😪 | 😋 | 😷
😎 | 😵 | 👿 | 😈 | 😐 | 😶 | 😇 | 👽 | 💛 | 💙 | 💜 | ❤️ | 💚 | 💔 | 💓 | 💗 | 💕 | 💞 | 💘 | ✨
| ּ_בּ | |
| בּ_בּ | |
| טּ_טּ | |
| כּ‗כּ | |
| לּ_לּ | |
| מּ_מּ | |
| סּ_סּ | |
| תּ_תּ | |
| ٩(×̯×)۶ | |
| ٩(̾●̮̮̃̾•̃̾)۶ |