Skip to content

Instantly share code, notes, and snippets.

View geocodinglife's full-sized avatar
👨‍💻
Keep Coding

Ricardo Alarcon geocodinglife

👨‍💻
Keep Coding
View GitHub Profile
@geocodinglife
geocodinglife / llm-wiki.md
Created April 5, 2026 04:10 — forked from karpathy/llm-wiki.md
llm-wiki

LLM Wiki

A pattern for building personal knowledge bases using LLMs.

This is an idea file, it is designed to be copy pasted to your own LLM Agent (e.g. OpenAI Codex, Claude Code, OpenCode / Pi, or etc.). Its goal is to communicate the high level idea, but your agent will build out the specifics in collaboration with you.

The core idea

Most people's experience with LLMs and documents looks like RAG: you upload a collection of files, the LLM retrieves relevant chunks at query time, and generates an answer. This works, but the LLM is rediscovering knowledge from scratch on every question. There's no accumulation. Ask a subtle question that requires synthesizing five documents, and the LLM has to find and piece together the relevant fragments every time. Nothing is built up. NotebookLM, ChatGPT file uploads, and most RAG systems work this way.

@geocodinglife
geocodinglife / rails-jsonb-queries
Created September 13, 2023 21:40 — forked from mankind/rails-jsonb-queries
Ruby on Rails-5 postgresql-9.6 jsonb queries
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails
#payload: [{"kind"=>"person"}]
Segment.where("payload @> ?", [{kind: "person"}].to_json)
#data: {"interest"=>["music", "movies", "programming"]}
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json)
Segment.where("data #>> '{interest, 1}' = 'movies' ")
Segment.where("jsonb_array_length(data->'interest') > 1")
@geocodinglife
geocodinglife / git-alias.md
Created February 3, 2023 02:25 — forked from Klerith/git-alias.md
Useful Git Alias

Log

git config --global alias.lg "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all"

Status

git config --global alias.s status --short

Alternativa útil de status

git config --global alias.s status -sb

Git Cheat Sheet

Basic commands

git init Creates a new git repository in the directory

git add <file name> Adds a specific file to staging

git add . or git add -A Adds the full directory and its contents to staging

@geocodinglife
geocodinglife / state_pattern.rb
Created September 2, 2019 03:16 — forked from travisjeffery/state_pattern.rb
State Pattern in Ruby
# State - allow an object to alter its behaviour when its internal state
# changes. The object will appear to change its class.
# Key idea - introduce an abstract class called SomethingState to represent the
# states of the object. Subclasses of the abstract class implement
# state-specific behaviour.
class Person
attr_accessor :state, :name
@geocodinglife
geocodinglife / latin1-to-utf8.rb
Created August 19, 2019 16:52 — forked from jeremyf/latin1-to-utf8.rb
A ruby script to help automate getting a Rails application out of MySQL's character encoding hell.
# The below script attempts to automate the character encoding challenges
# encountered with mysql, latin1 and UTF8
# http://www.bluebox.net/news/2009/07/mysql_encoding/
# ==============================================================================
# Copyright © 2013 University of Notre Dame
# Additional copyright may be held by others, as reflected in the commit history.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@geocodinglife
geocodinglife / multiple_ssh_setting.md
Created June 15, 2019 15:22 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@geocodinglife
geocodinglife / capybara cheat sheet
Created February 19, 2019 22:09 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@geocodinglife
geocodinglife / postgres-cheatsheet.md
Created February 10, 2019 00:01 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@geocodinglife
geocodinglife / my_mailer.rb
Created January 18, 2019 13:14 — forked from Nosfheratu/my_mailer.rb
send pdf attachment
class MyMailer < ApplicationMailer
def send_invoice user, invoice
@user = user
@invoice = invoice
invoice_attachment = WickedPdf.new.pdf_from_string(render_to_string(pdf: "invoice", template: 'payments/charges/invoice.pdf.erb'))
attachments["I#{sprintf('%06d', @invoice.id)}.pdf"] = invoice_attachment
mail(to: @user.email,
subject: "Your invoice", template_path: 'users_mailer')
end
end