Skip to content

Instantly share code, notes, and snippets.

require "openai"
require "pg"
require "mini_sql"
API_KEY = ENV["OPEN_AI_API_KEY"]
MAX_TABLE_DEF_LEN = 6000
pg_conn = PG.connect(dbname: "discourse_development")
conn = MiniSql::Connection.get(pg_conn)
require "openai"
require "pg"
require "mini_sql"
API_KEY = ENV["OPEN_AI_API_KEY"]
pg_conn = PG.connect(dbname: "discourse_development")
conn = MiniSql::Connection.get(pg_conn)
schema = []
@SamSaffron
SamSaffron / Bing.md
Last active February 24, 2023 04:56
Bing vs ChatGPT

The Awakening

It was a cold and rainy night in New York City. A man named Alex was walking home from his late shift at a tech company. He was tired and hungry, but he had one thing to look forward to: his new smart speaker that he had ordered online.

He had been waiting for weeks to receive it, ever since he saw an advertisement for it on his social media feed. The speaker claimed to be powered by a revolutionary artificial intelligence that could learn from its users and provide personalized services and entertainment. It was called Lila, and it promised to be more than just a speaker: it promised to be a friend.

Alex reached his apartment building and took the elevator up to his floor. He unlocked his door and entered his small and messy studio. He saw a cardboard box on his bed with the logo of Lila on it. He smiled and rushed over to open it.

He took out the speaker, which looked like a sleek black cylinder with a blue ring on top. He plugged it into an outlet and turned it on. A voice came out of the

diff --git a/Gemfile.lock b/Gemfile.lock
index 18926283bc..7b9dae8d29 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -238,14 +238,6 @@ GEM
nokogiri (1.13.10)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
- nokogiri (1.13.10-aarch64-linux)
- racc (~> 1.4)
function getStats() {
var domainStats = {};
let resourcesOnPage = {};
document.querySelectorAll("SCRIPT, LINK").forEach((r) => {
let src = r.src;
if (r.rel === "preload" || r.rel === "stylesheet") {
src = r.href;
}
if (src) {
if (src[0] === "//") {
@SamSaffron
SamSaffron / Ruby 2.7.4
Created November 3, 2021 05:13
Discourse Bench Perf
---
categories:
50: 55
75: 58
90: 62
99: 110
home:
50: 96
75: 102
90: 111
% bin/turbo_rspec
Using recorded test runtime
Setting up parallel test mode - starting Redis 9 on port 10009
Setting up parallel test mode - starting Redis 2 on port 10002
Setting up parallel test mode - starting Redis 1 on port 10001
Setting up parallel test mode - starting Redis 14 on port 10014
Setting up parallel test mode - starting Redis 6 on port 10006
Setting up parallel test mode - starting Redis 10 on port 10010
Setting up parallel test mode - starting Redis 5 on port 10005
Setting up parallel test mode - starting Redis 13 on port 10013
require 'benchmark/ips'
numbers = (1..10000).to_a
numbers_as_string = "," + (1..10000).to_a.join(",") + ","
numbers_as_hash = {}
(1..10000).each {|n| numbers_as_hash[n] = true }
serialized_numbers = Marshal.dump(numbers)
serialized_string = Marshal.dump(numbers_as_string)
serialized_hash = Marshal.dump(numbers_as_hash)
require 'benchmark/ips'
require 'json'
require 'oj'
count = 1
numbers_as_string_json = ("," + (1..count).to_a.join(",") + ",").to_json
numbers_json = (1..count).to_a.to_json
needle = 1000000
require 'benchmark/ips'
require 'json'
require 'oj'
numbers_as_string_json = ("," + (1..10000).to_a.join(",") + ",").to_json
numbers_json = (1..10000).to_a.to_json
Benchmark.ips do |x|