Skip to content

Instantly share code, notes, and snippets.

View dan-palmer's full-sized avatar
👨‍💻

Dan Palmer dan-palmer

👨‍💻
View GitHub Profile
@dan-palmer
dan-palmer / prompt.json
Created February 2, 2024 13:49
Arc Search Browse for Me Prompt
{
"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"
},
@dan-palmer
dan-palmer / example.js
Created January 2, 2024 11:16
Node Axios Teller Client Example
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
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("📝")
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

Teller Bank Challenge

Mix.install([:req, :jason, :kino])

Your Solution

@dan-palmer
dan-palmer / springer-free-maths-books.md
Created December 28, 2015 16:35 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of maths books available for free, here are the direct links
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
@dan-palmer
dan-palmer / psqlfix.txt
Created October 26, 2015 15:52
Change postgres default template0 to UTF8 encoding
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
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
@dan-palmer
dan-palmer / rabbit_mq_connection_test.rb
Last active August 29, 2015 14:23
Testing a connection to Rabbit MQ
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