This file contains hidden or 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
import { Assistant } from "openai/resources/beta/assistants/assistants"; | |
import { Message } from "openai/resources/beta/threads/messages/messages"; | |
import { RequiredActionFunctionToolCall } from "openai/resources/beta/threads/runs/runs"; | |
import { Thread } from "openai/resources/beta/threads/threads"; | |
import { searchInput } from "src/handlers/search"; | |
import { adminUpdateAiThreadExtra } from "src/operations/ai_thread"; | |
import { openai } from "../lib/openai"; | |
import { | |
getMessageContent, | |
parsePlain, |
This file contains hidden or 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
const request = require('request-promise-native'); | |
const parseLinkHeader = require('parse-link-header'); | |
const fs = require('fs'); | |
/* | |
* This is an idempotent script for downloading pr & review data for a single repository | |
* Set the repo and auth variables below, then run and wait. its not speedy, but it works | |
* | |
* If you stop the script or it dies or you trigger abuse detection, it is safe to restart. | |
* it will only download the remaining data, any requests that were pending at the time of |
This file contains hidden or 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
module Main where | |
import Data.Generic | |
import Prelude | |
import Control.Monad.Free (Free, liftF, runFreeM) | |
import Control.Monad.Eff | |
import Control.Monad.Eff.Console (log, CONSOLE) | |
import Control.Monad.Eff.Random (randomBool, RANDOM) | |
data Action = |
This file contains hidden or 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
import { Dictionary, Entry, entries, dict } from './Dictionary'; | |
import { KVPair, kvPair } from './object'; | |
import { identity } from './utils'; | |
type Transformer<C, X> = (c: C, context?: X) => C; | |
type Getter<S, C> = (s: S) => C; | |
type Setter<S, C> = (s: S, v: C) => S; | |
type Reducer<R, C, X> = (sum: R, value: C, context: X) => R; |
This file contains hidden or 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
import { isEqual } from 'lodash'; | |
/* | |
* Usage: imagine you have part of a reducer like this: | |
* | |
* switch(action.type) { | |
* case 'CAMPAIGN_INITIALISED': | |
* campaign = state[action.campaignId]; | |
* return { | |
* ...state, |
This file contains hidden or 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
import sys | |
def printstr(string): | |
sys.stdout.write(string) | |
def func(level): | |
if level == 0: | |
return | |
printstr("anti-") |
This file contains hidden or 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
module CumulativeBinomialDistribution | |
extend self | |
# s = successes | |
# p = probability of success per trial | |
# n = number of trials | |
def normal_estimate(s, p, n) | |
u = n * p | |
o = (u * (BigDecimal.new('1')-p)) ** BigDecimal.new('0.5') | |
# continuity correction |
This file contains hidden or 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
-- This is a general process for recreating tables in postgres without downtime | |
-- it can help you recover from data corruption bugs like one seen in Postgres 9.3 | |
-- The table in question should have no foreign key contraints | |
-- in this example I migrate a table called bibliography_entries to a table called bib_entries | |
-- create the new table | |
CREATE TABLE bib_entries (LIKE bibliography_entries INCLUDING ALL); | |
-- create a temporary table to hold the changes while the bulk of the table is migrated | |
CREATE TABLE bib_entries_tmp (LIKE bibliography_entries INCLUDING ALL); |
Images are built using packer. Packer takes care of booting a source image, bootstrapping it, running your configuration management and then shutting down and creating an ami. It can run multiple builds in parallel
To make image building super simple, there is a python script build_image.py
which simply takes the name of an image to build, the various images are
configured in images.yml
. The build_image.py
script will find the appropriate source ami, generate the configuration for packer, and then run packer.
NewerOlder