Skip to content

Instantly share code, notes, and snippets.

@mnordin
mnordin / rate_limiter.rb
Last active March 13, 2026 14:41
Simple rate limiter using ruby mutex
require "singleton"
# Thread-safe rate limiter that caps how many threads can execute concurrently.
# Works like ActiveRecord::ConnectionPool — a max size, a counter, and threads
# waiting for an available slot when the pool is full.
class RateLimiter
DEFAULT_MAX_CONCURRENT = 10
include Singleton
@mnordin
mnordin / malware_check.sh
Last active September 9, 2025 10:33
npm debug malware check for MacOS
# install ripgrep (optional, but way faster)
brew install ripgrep
# Use grep f you do not have ripgrep. This will take some time.
cd / && sudo grep -nr '_0x124ed3' 2>&1 | grep -v "Operation not permitted"
# You will get a bunch of permission errors, these are expected
# Filter them out by |grep -v "Operation not permitted"
# Check for keyword match for the malware in all js files on your computer
@mnordin
mnordin / config.json
Created August 29, 2025 07:17
Zed config for rubocop lsp that requires bundle exec execution
{
"languages": {
"Ruby": {
"language_servers": ["ruby-lsp"],
"formatter": "language_server"
}
},
"lsp": {
"ruby-lsp": {
"binary": {
@mnordin
mnordin / keybase.md
Created February 20, 2025 13:56
Keybase

Keybase proof

I hereby claim:

  • I am mnordin on github.
  • I am mnordin (https://keybase.io/mnordin) on keybase.
  • I have a public key ASBScGzomIqHlk1njYf-_zxKecFvsE0ELKAuLTswuU324wo

To claim this, I am signing this object:

@mnordin
mnordin / ddns
Last active March 26, 2021 07:37
Secure Jellyfin (nginx) with dynamic whitelisted IP addresses
foo.example.com
bar.example.com
baz.example.com
@mnordin
mnordin / instagram_image_downloader.rb
Last active December 8, 2017 14:56
Download all images from a public Instagram account or hashtag
require 'cgi'
require 'open-uri'
require 'json'
if ARGV[0].to_s.start_with?("#")
tag = CGI.escape(ARGV[0].to_s).sub(/\A%23/, "")
else
username = ARGV[0]
end
@mnordin
mnordin / gist:1338234
Created November 3, 2011 23:17
Example form without jQuery Mobile ajax transition
<%= form_for @user, :'data-ajax' => "false" do |f| %>
<!-- form body -->
<%= f.submit "Save", :'data-theme' => "b" %>