Skip to content

Instantly share code, notes, and snippets.

View albertico-gov's full-sized avatar

Alberto albertico-gov

View GitHub Profile
@MarkRoddy
MarkRoddy / parse_s3_access_logs.sql
Last active November 27, 2024 19:35
DuckDB: Query S3 Access Logs
/*
Usage: you'll want to search for the strings <bucket> and <prefix>, and insert the S3 bucket where your access
logs are being delivered. Use (or delete) <prefix> to filter to a subset of your logs.
*/
/*
These commented out configuration settings you can either run yourself in the REPL and source this file using
`.read parse_s3_access_logs.sql`, or you can uncomment them and supply values for yourself.
@amirrajan
amirrajan / main.rb
Last active February 22, 2023 21:46
DragonRuby Game Toolkit - AABB + Physics (https://dragonruby.org/toolkit/game)
# https://youtu.be/HQTfqaIxSOA
def tick args
args.state.id_seed ||= 1
args.state.bullets ||= []
args.state.terrain ||= [
{
x: 40, y: 0, w: 1200, h: 40, path: :pixel, r: 0, g: 0, b: 0
},
{
x: 1240, y: 0, w: 40, h: 720, path: :pixel, r: 0, g: 0, b: 0
@kieranklaassen
kieranklaassen / chat_gpt_service.rb
Created December 5, 2022 14:07
Unofficial ChatGPT API Wrapper Ruby
# The ChatGptService class provides an easy way to integrate with the OpenAI ChatGPT API.
# It allows you to send and receive messages in a conversation thread, and reset the thread
# if necessary.
#
# Example usage:
# chat_gpt_service = ChatGptService.new(BEARER_TOKEN)
# response = chat_gpt_service.chat("Hello, how are you?")
# puts response
# # => {"message"=>
# # {"id"=>"8e78691a-1fde-4bd5-ad68-46b23ea65d8f",
@jdarcy
jdarcy / activitypub.md
Created November 9, 2022 16:10
Some thoughts about ActivityPub

I've commented a few times about some issues I see with the scalability of ActivityPub - the protocol behind the Fediverse and its best-known implementation Mastodon. A couple of folks have asked for more elaboration, so ... here it is.

First, let me add some disclaimers and warnings. I haven't devoted a lot of time to looking at ActivityPub, so there might be some things I've misunderstood about it. On the other hand, I've brought bigger systems - similar node counts and orders of magnitude more activity per node - from broken to working well based on less study of the protocols involved. So if you want to correct particular misconceptions, that's great. Thank you in advance. If you want to turn this into an appeal to authority and say that I'm wrong only because I haven't developed a full ActivityPub implementation or worked on it for X years ... GTFO.

What

What is ActivityPub? It's an HTTP- and JSON-based protocol for exchanging information about "activities". An activity could be many things.

@thiagofm
thiagofm / pattern_matching_type.rb
Created September 4, 2022 08:43
Ruby Pattern Matching on Type
# Ruby pattern matching based on Type (=> operator)
[1,2,3] => [1, Integer, my_variable]
# This means:
# We want to assign `my_variable` (variable binding),
# but only if the first position is 1 and second position is an Integer)
my_variable # => 3 ✨
# What if it doesn't match? You get an exception 💣
[1,2,3] => [Integer, String, my_variable]
# [1, 2, 3]: String === 2 does not return true (NoMatchingPatternError)
@rochacbruno
rochacbruno / gruvbox-dark.micro
Created April 21, 2022 18:49
Gruvbox Dark Theme for Micro Editor
color-link default "#ebdbb2,#1d2021"
color-link comment "#928374,#1d2021"
color-link symbol "#d79921,#1d2021"
color-link constant "#d3869b,#1d2021"
color-link constant.string "#b8bb26,#1d2021"
color-link constant.string.char "#b8bb26,#1d2021"
color-link identifier "#8ec07c,#1d2021"
color-link statement "#fb4934,#1d2021"
color-link preproc "#fb4934,235"
color-link type "#fb4934,#1d2021"
@zunda
zunda / shc-payload.rb
Last active December 14, 2022 07:07
Read the payload from a SMART Health Card
#!/usr/bin/ruby
#
# usage: echo shc:/0123..(decoded from a QR code) | ruby shc-payload.rb | jq
# Prints the payload from SMART Health Card on QR code
# https://spec.smarthealth.cards/
#
# Copyright 2021 by zunda <zundan at gmail.com>
#
# Permission is granted for use, copying, modification, distribution,
# and distribution of modified versions of this work as long as the
@font-face {
font-family: "Fira Code Nerd Font";
font-style: normal;
font-weight: 200;
src: url('https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/patched-fonts/FiraCode/Light/complete/Fira%20Code%20Light%20Nerd%20Font%20Complete.ttf') format('truetype');
}
@font-face {
font-family: "Fira Code Nerd Font";
font-style: normal;
font-weight: 400;
@cmgiven
cmgiven / cms-acronyms.csv
Created April 21, 2020 20:14
CMS Acronyms
acronym definition
4I 4 Innovation (System)
ACA Patient Protection and Affordable Care Act
ACE Acute Care Episode
ACO Accountable Care Organization
ACO-MS Accountable Care Organization - Management System
ACO-OS Accountable Care Organization - Operational System
ACO-UI Accountable Care Organization - User Interface
AGI Adjusted Gross Income
AHRQ Agency for Healthcare Research and Quality

mlgrm's run ubuntu in crostini

this gist is out of date and remains here only for reference

This is just a modification of this reddit to minimize copying and pasting, make it less interactive, and to allow creation of a username of your choice instead of the default google email address.

# #How to run Ubuntu with full Chrome OS Integration
# Here's a post that shows in detail how to make the default penguin container run Ubuntu instead of Debian:
# [Introduction to Crostini - Part 3: Using Ubuntu by default](https://linuxiumcomau.blogspot.com/2018/08/introduction-to-crostini-part-3-using.html)