Skip to content

Instantly share code, notes, and snippets.

View gmcabrita's full-sized avatar

Gonçalo Mendes Cabrita gmcabrita

View GitHub Profile
// ==UserScript==
// @name Youtube — Honest Thumbnails
// @namespace https://github.com/851-labs/honest-thumbnails
// @version 1.0.0
// @description Replaces YouTube's clickbait thumbnails with a real frame from the middle of the video.
// @author 851 Labs (userscript port)
// @license MIT
// @match *://*.youtube.com/*
// @match *://*.youtube-nocookie.com/*
// @icon https://youtube.com/favicon.ico

After PR 42498, the work is in three areas: the pattern gap, the domain gap and the wrong-person guesses. The order below follows measured gain and risk. Each item is one branch named feature/ld-3044-<name>.

flowchart LR
  A[42498 merged<br/>name split] --> B[spanish-pattern-labels<br/>Liverpool, Herdez, Cemex]
  A --> C[domain-evidence<br/>FEMSA, Bimbo]
  B --> E[Clara list re-run]
  C --> E
  A --> D[follow-up cleanups]
@gmcabrita
gmcabrita / karafka_web_ui.user.js
Created December 3, 2024 14:50
karafka web ui, hide topic lags at 0 from tooltip
// ==UserScript==
// @name Karafka Web UI Fixes
// @description Fixes some Karakfa Web UI annoyances
// @namespace http://tampermonkey.net/
// @version 2024-12-03
// @author Gonçalo Cabrita
// @match *://*/karafka/dashboard*
// @updateURL https://gist.github.com/gmcabrita/55568fcc1c4bd11f20b4f33980696555/raw/karafka_web_ui.user.js
// @downloadURL https://gist.github.com/gmcabrita/55568fcc1c4bd11f20b4f33980696555/raw/karafka_web_ui.user.js
// @supportURL https://gist.github.com/gmcabrita/55568fcc1c4bd11f20b4f33980696555#new_comment_field
== Parsing redacted.json (6259 bytes)
ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [arm64-darwin23]
Warming up --------------------------------------
          json 2.8.1     4.675k i/100ms
                  oj     3.907k i/100ms
          Oj::Parser     6.201k i/100ms
           rapidjson     3.364k i/100ms
Calculating -------------------------------------
          json 2.8.1     47.534k (± 5.9%) i/s   (21.04 μs/i) -    238.425k in   5.038350s
~/Developer/ruby-json-bench (main) % bundle exec awfy ips JSON 'parsing'
Running IPS for:
> JSON/parsing...
> [mri - branch 'main'] JSON / parsing
> [yjit - branch 'main'] JSON / parsing
+---------------------------------------------------------------+
|                         JSON/parsing                          |
+--------+---------+-----------------+------------+-------------+
| Branch | Runtime | Name            | IPS        | Vs baseline |

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas facilisis molestie libero nec ultrices. Curabitur ut odio eget dolor convallis tempor. Pellentesque non nibh at eros dapibus sollicitudin vitae eget tellus. Donec ut metus non turpis lobortis ultricies a sed nisl. Aenean elementum consequat erat, sed tempor nunc. Nam eu vestibulum enim, et ullamcorper urna. Morbi fringilla congue justo suscipit vestibulum. Sed at enim et mauris luctus vehicula. In bibendum odio at felis vehicula tincidunt. Mauris cursus neque ac ex porta, ut lobortis neque aliquet. Nunc magna dolor, tempor eu libero eu, cursus venenatis lacus. Etiam ac elementum ligula. Pellentesque sollicitudin consectetur libero eget rhoncus. Integer mauris neque, eleifend vel tellus sit amet, imperdiet rutrum leo.[^1]

Quisque at metus ut orci vehicula bibendum ut eu lorem. Nam eu vestibulum lorem. Duis id ante libero. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nam condimentum magna eget com

If you’re an app developer reading this, can you tell me, off the top of your head, how your app behaves on a link with 40 kbps available bandwidth, 1,000 ms latency, occasional jitter of up to 2,000 ms, packet loss of 10%, and a complete 15-second connectivity dropout every few minutes?

https://chatgpt.com/share/13e444bc-f16e-4ce7-841f-e8362f366da4

macOS

1. Create a configuration file for pfctl

sudo nano /etc/pf.conf:

@gmcabrita
gmcabrita / .index.yml_generator.rb
Last active June 5, 2024 14:21
ruby-lsp .index.yml excluded_gems generator
require "yaml"
require "bundler"
config_file = ".index.yml"
config = if File.exist?(config_file)
YAML.load_file(config_file)
else
{}
end
bundler_gems = Bundler.locked_gems&.specs.map { _1.name }
@gmcabrita
gmcabrita / rss2gmail.js
Last active May 16, 2024 21:36
gmail gapps script rss feed reader
function fetchAndEmailRSSFeeds() {
const rssUrls = [
"https://brandur.org/atoms.atom",
"https://sirupsen.com/atom.xml",
"https://ferd.ca/feed.rss",
"https://andrewkelley.me/rss.xml",
"https://apenwarr.ca/log/rss.php",
"https://www.evanjones.ca/index.rss",
"https://danluu.com/atom.xml",
"https://thume.ca/atom.xml",
# config/initializers/active_record.rb
Rails.application.reloader.to_prepare do
ActiveRecord::Relation.include(ExplainAnalyze::Relation)
end