-
console1984 — Privacy-aware Rails console that records sessions and protects encrypted data. Blog: Privacy-aware Rails consoles
-
audits1984 — Auditing interface for console1984 sessions. Blog: [Privacy-aware Rails
I am running a Linux system and need help with configuration, setup, and administration tasks. Please assist me following Linux best practices and respecting system defaults.
- Distribution: Omarchy Linux (Arch-based)
- Window Manager: Hyprland
- Home Directory: /home/jorge
- Working Directory: Check with
pwdbefore making assumptions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "rss" | |
| require "ostruct" | |
| RSS_FEED_URL = "https://world.hey.com/jorge/feed.atom" | |
| def sync_posts | |
| feed = RSS::Parser.parse(RSS_FEED_URL, false) | |
| feed.items.each do |item| | |
| post = OpenStruct.new title: item.title.content, date: item.published.content.strftime("%Y-%m-%d"), link: item.link.href |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'ruby2d' | |
| # Define constants | |
| GRID_SIZE = 9 | |
| CELL_SIZE = 60 | |
| WINDOW_SIZE = CELL_SIZE * GRID_SIZE | |
| FONT_SIZE = 20 | |
| # Create Window | |
| set title: "Ruby Sudoku", width: WINDOW_SIZE, height: WINDOW_SIZE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'csv' | |
| require 'date' | |
| require 'ostruct' | |
| require 'open-uri' | |
| require 'fileutils' | |
| class BooksConverter | |
| OUTPUT_FOLDER = "output" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "benchmark" | |
| # https://github.com/rails/rails/pull/42761 | |
| class Execution | |
| TEST_FILE_PATH = "test/threshold_test.rb" | |
| SINGLE_TEST_DURATION = 0.1 | |
| attr_reader :threshold, :parallel | |
| def initialize(threshold, parallel: false) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module DiscourseUsersMerger | |
| class Merger | |
| def merge(target_username, source_username) | |
| raise "User to merge and target user can't be the same" if target_username == source_username | |
| target_user = User.find_by_username!(target_username) | |
| source_user = User.find_by_username!(source_username) | |
| puts "About to merge #{source_username} (#{source_user.email}) into #{target_username} (#{target_user.email})" | |
| puts "#{source_user.topics.count} topics with #{source_user.posts.count} posts will be moved. Ok to continue? (y/n)" | |
| continue = STDIN.gets.chomp.downcase == 'y' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def count_from_table_stats(klass) | |
| result = klass.connection.execute("show table status like '#{klass.table_name}'") | |
| result.first[result.fields.index("Rows")] | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module DisableReloaderWhileRunningTests | |
| extend ActiveSupport::Concern | |
| included do | |
| setup do | |
| @reloader_check = Rails.application.reloader.check | |
| Rails.application.reloader.check = -> { false} | |
| end | |
| teardown do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'benchmark/ips' | |
| module PerformanceHelpers | |
| BENCHMARK_DURATION = 1 | |
| BENCHMARK_WARMUP = 1 | |
| BASELINE_LABEL = "Baseline" | |
| CODE_TO_TEST_LABEL = "Code" | |
| # Usage: |
NewerOlder