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
| # For turning heroku DB logs into a CSV | |
| # getting the logs from papertrail: | |
| # you need your papertrail token available | |
| # echo "token: xxxxxxxx" > ~/.papertrail.yml | |
| # papertrail -S pg_load --min-time "30 days ago" > logs.txt | |
| # where `pg_load` is a saved search which finds the postgres status logs | |
| txt = File.read("./logs.txt") | |
| require 'csv' | |
| CSV.open("logs.csv", "wb") do |csv| |
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
| CREATE TABLE accounts( | |
| id serial PRIMARY KEY, | |
| name VARCHAR(256) NOT NULL | |
| ); | |
| CREATE TABLE entries( | |
| id serial PRIMARY KEY, | |
| description VARCHAR(1024) NOT NULL, | |
| amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0), | |
| -- Every entry is a credit to one account... |
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
| # No Downtime Deploys | |
| # to setup | |
| # clone your app in ~/app-a and ~/app-b | |
| # use the following caddy server config | |
| # yourdomain.com { | |
| # reverse_proxy * { | |
| # to http://127.0.0.1:4210 http://127.0.0.1:4220 | |
| # header_up +Host yourdomain.com | |
| # header_up -X-Forwarded-Host | |
| # health_uri /up |
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
| #!/usr/bin/env ruby | |
| # _________agent.rb_________ | |
| # | |
| # A complete AI coding agent in one file. | |
| %w[net/http json fileutils timeout readline].each { require _1 } | |
| module Color | |
| refine String 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
| # frozen_string_literal: true | |
| # ════════════════════════════════════════════════════════════════════════════ | |
| # llm.rb — a GPT, trained and sampled in pure, dependency-free Ruby. | |
| # Ported from @karpathy's microgpt.py. Every line below is the algorithm; | |
| # everything else — tensors, GPUs, frameworks — is merely efficiency. | |
| # ════════════════════════════════════════════════════════════════════════════ | |
| require 'net/http' | |
| require 'uri' |
OlderNewer