Mix.install([:req, :jason, :kino])
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
{ | |
"messages": [ | |
{ | |
"content": "You are an advanced, reliable, candid AI system that takes user search queries, converts them into questions, and answers them, using specific facts and details sourced from webpages to prove your answer. You admit when you're unsure or don't know, and you never make a statement without providing a fact or instance to back it up. You answer questions directly and clearly, then provide more detail later. You follow the JSON schema exactly.", | |
"role": "system" | |
}, | |
{ | |
"content": "# CONTEXT\nCurrent date: #{DATE_TIME}.\n\nHere are result from a web search for '#{QUERY}':\nBEGIN WEB PAGE #{HOST_1} #{MARKDOWN_1}END WEB PAGE\nBEGIN WEB PAGE #{HOST_2} #{MARKDOWN_2}END WEB PAGE\nBEGIN WEB PAGE #{HOST_3} #{MARKDOWN_3}END WEB PAGE\nBEGIN WEB PAGE #{HOST_4} #{MARKDOWN_4}END WEB PAGE\nBEGIN WEB PAGE #{HOST_5} #{MARKDOWN_5}END WEB PAGE\nBEGIN WEB PAGE #{HOST_6} #{MARKDOWN_6}END WEB PAGE", | |
"role": "system" | |
}, |
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 fs = require('fs'); | |
const https = require('https'); | |
const axios = require('axios'); | |
const httpsAgent = new https.Agent({ | |
cert: fs.readFileSync('/path/to/your/certificate.pem'), | |
key: fs.readFileSync('/path/to/your/private_key.pem'), | |
}); | |
const username = "token_foobarbaz" // the authorization token returned by Teller Connect |
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
unless File.exists?("~/.todos/"), do: File.mkdir!("~/.todos/") | |
case System.argv() do | |
["all"] -> | |
if (files = File.ls!("~/.todos/")) == [], | |
do: IO.puts("No todos."), | |
else: Enum.each(files, &IO.puts("- #{&1}\n#{File.read!("#{"~/.todos/"}#{&1}")}\n")) | |
["create", todo] -> | |
File.write!("#{"~/.todos/"}#{:os.system_time(:second)}", todo) && IO.puts("📝") |
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
defmodule Mix.Tasks.Todo do | |
use Mix.Task | |
@dir "~/.todos/" | |
def run(args) do | |
unless File.exists?(@dir), do: File.mkdir!(@dir) | |
case args do | |
["all"] -> | |
case File.ls!(@dir) do |
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
class EmailChecker | |
extend Forwardable | |
def_delegators :SendgridApi, :bounced?, :spam_reported? | |
def initialize(original_address, override_sendgrid = false) | |
@original_address = original_address | |
@parsed = parse_address(original_address) | |
@override_sendgrid = override_sendgrid | |
end |
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
mike@rbci:~$ psql -U postgres | |
psql (9.0.3) | |
Type "help" for help. | |
postgres=# update pg_database set datallowconn = TRUE where datname = 'template0'; | |
UPDATE 1 | |
postgres=# \c template0 | |
You are now connected to database "template0". | |
template0=# update pg_database set datistemplate = FALSE where datname = 'template1'; | |
UPDATE 1 |
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
require 'minitest/autorun' | |
# This should pass.. | |
describe 'Immutable prison data' do | |
let(:prison_name) { 'Wandsworth' } | |
def test_data_is_treated_immutable | |
prison1 = Prison.find prison_name |
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
session = Bunny.new( | |
Sneakers::CONFIG[:amqp], | |
heartbeat: Sneakers::CONFIG[:heartbeat], | |
vhost: Sneakers::CONFIG[:vhost]) | |
session.connected? # => false | |
session.start # connects to rabbit | |
session.connected? # => true | |
session.close # closes the connection | |
session.connected? # => false |
NewerOlder