Skip to content

Instantly share code, notes, and snippets.

View ddrscott's full-sized avatar

Scott Pierce ddrscott

View GitHub Profile
@BrianMehrman
BrianMehrman / prettySQL.py
Last active July 5, 2018 20:10
pretty print your SQL
#!/usr/bin/env python
import argparse
import sys
import sqlparse
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters import TerminalTrueColorFormatter
def prettyPrint(raw_sql):
@a7v8x
a7v8x / graphql_introspection_query.graphql
Last active November 5, 2023 12:36
GraphQL introspection query - for fetching the whole schema (from GraphiQL IDE) for https://atheros.ai/blog/graphql-introspection-and-introspection-queries
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
types {
...FullType
}
directives {
name
description
@sanp
sanp / 2pa.md
Last active August 23, 2019 18:51

Second Price Auctions

Overview

  • Second price auctions (2PA) are a type of auction where the highest bidder pays the second highest bid
  • In contrast to first price auctions (FPA), where the highest bidder pays her own bid

In this talk, going to go over

  • Why 2PA work better than FPA
@ddrscott
ddrscott / cf-gpt.sh
Created November 22, 2023 19:02
Cloudflare AI inference API
#!/bin/sh
# message can come from script args or environment
message=${message:-"${*}"}
model=${model:-"@cf/mistral/mistral-7b-instruct-v0.1"}
system=${system:-"You are a consice AI assistant. You help the user the best you can. If you don't know something, you admin it and ask clarifying questions. Use markdown as needed."}
post_data=$(cat <<JSON
{"messages":[{"role":"system","content":"${system}"},{"role":"user","content":"${message}"}],"max_tokens":10240,"stream":true}
JSON
)