Skip to content

Instantly share code, notes, and snippets.

View jodosha's full-sized avatar

Luca Guidi jodosha

View GitHub Profile
@peterc
peterc / embedding_store.rb
Last active December 28, 2023 06:27
Using SQLite to store OpenAI vector embeddings from Ruby
# Example of using SQLite VSS with OpenAI's text embedding API
# from Ruby.
# Note: Install/bundle the sqlite3, sqlite_vss, and ruby-openai gems first
# OPENAI_API_KEY must also be set in the environment
# Other embeddings can be used, but this is the easiest for a quick demo
# More on the topic at
# https://observablehq.com/@asg017/introducing-sqlite-vss
# https://observablehq.com/@asg017/making-sqlite-extension-gem-installable
@huytd
huytd / todo.vim
Created June 14, 2020 07:34
A Todo list syntax in Vim, with an actual checkbox
" Vim syntax file
" Language: Todo
" Maintainer: Huy Tran
" Latest Revision: 14 June 2020
if exists("b:current_syntax")
finish
endif
" Custom conceal
@derekmahar
derekmahar / install_nix_in_an_lxd_container.md
Last active February 22, 2024 12:38
How to Install Nix in an LXD Container

How to Install Nix in an LXD Container

Steps to install the Nix package manager inside an Ubuntu 20.04 LXD container using the images:ubuntu/focal image:

  1. On the LXD host, create an Ubuntu 20.04 container:
    lxc init images:ubuntu/focal container1
    
  2. On the LXD host, enable nested security on the container:
@jonico
jonico / query_github_audit_log.graphql
Created June 6, 2019 22:11
How to query GitHub's audit log with GraphQL
query {
organization(login: "se-saml") {
auditLog(first: 50) {
edges {
node {
... on RepositoryAuditEntryData {
repository {
name
}
}
@paneq
paneq / links.md
Last active July 28, 2020 14:29
My (Robert Pankowecki's) favourite books, presentations, blog-posts and articles related to Software Development in the whole Internet (that I remembered of)
@5minpause
5minpause / rspec.rb
Created March 7, 2018 12:19
how to use sessions with capybara
# support/setup.rb
def in_browser(name)
old_session = Capybara.session_name
Capybara.session_name = name
yield
ensure
Capybara.session_name = old_session
end
@enricofoltran
enricofoltran / main.go
Last active April 1, 2024 00:17
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@foca
foca / release
Last active March 31, 2023 14:15
Small shell script to create GitHub releases from the command line
#!/usr/bin/env bash
set -e
[ -z "$DEBUG" ] || set -x;
usage() {
echo "$0 <repo> <tag> [<release name>] [-- <asset>...]" >&2;
}
if [ "$1" = "-h" -o "$1" = "--help" ]; then
module CommandPlugins
module ActiveRecordTimestamps
class HashWithTimestamps
def initialize(input)
@input = input
end
def [](*args)
tuple = @input[*args]
Class.new(ROM::Repository[relation]) do
defines :mapping
commands :create, update: :by_id, delete: :by_id, mapper: mapping
self.mapping mapping
def find(id)
collection.by_id(id).one
end
def all