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
| #!/bin/bash | |
| # Enhanced FLAC to M4A conversion script with proper concurrency control | |
| set -euo pipefail | |
| get_total_size() { | |
| local files=("$@") | |
| if [[ ${#files[@]} -gt 0 ]]; then | |
| du -shc "${files[@]}" 2>/dev/null | tail -n1 | cut -f1 | |
| else |
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
| #!/usr/bin/env ruby | |
| # Usage: extract_subs movie.mkv | |
| ENGLISH_VARIATIONS = %w[eng en english].freeze | |
| file = ARGV[0] | |
| abort("Usage: #{$0} file.mkv") unless file && File.exist?(file) | |
| # Run mkvinfo and capture output | |
| mkvinfo_output = `mkvinfo "#{file}"` |
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
| #!/usr/bin/env ruby | |
| require "nokogiri" | |
| require "json" | |
| module Cfdi | |
| module_function | |
| def parse_file(xml_path) | |
| doc = Nokogiri::XML(File.read(xml_path)) |
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
| # frozen_string_literal: true | |
| require 'bundler/inline' | |
| gemfile(true) do | |
| gem 'rails', '~> 7.0' | |
| gem 'sqlite3' | |
| end | |
| require 'active_record' |
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
| # frozen_string_literal: true | |
| source "https://rubygems.org" | |
| gem "bunny", "~> 2.19" |
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
| # frozen_string_literal: true | |
| require 'json' | |
| require 'net/http' | |
| require 'concurrent' | |
| class RickAndMorty | |
| def character(id) | |
| response = get_response("https://rickandmortyapi.com/api/character/#{id}") | |
| return {} unless response.is_a?(Net::HTTPSuccess) |
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 'bundler/inline'; gemfile(true) { gem 'rails', '~> 6.1.3'; gem 'puma' } | |
| require 'rails'; require 'action_controller/railtie'; | |
| Codes = Struct.new(:id) { def to_json(args = {}) = { id: id, hex: SecureRandom.hex, iat: Time.now.utc.to_i }.to_json(args) } | |
| class CodesApp < Rails::Application | |
| config.secret_key_base = '4bdd3baa5f573f06c71cfb0504273e7ed1cf95858d7be6268bd1c7f800bbd03e1169e89106a9cf99541ac1b75ad4685d731723a30660c2cc66912609fd008090' | |
| Rails.logger = Logger.new($stdout) | |
| end | |
| Rails.application.routes.draw { get '/:id', to: lambda { |env| [200, { 'Content-Type' => 'application/json' }, [Codes.new(env['action_dispatch.request.path_parameters'][:id]).to_json]] } } | |
| run CodesApp |
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
| class Bomb | |
| def method_missing(meth, *args, &blk) | |
| self.class.send(:define_method, "is_#{meth}?") { true } | |
| send("is_#{meth}?") | |
| end | |
| end | |
| if __FILE__ == $0 | |
| require 'SecureRandom' | |
| loop { Bomb.new.send(SecureRandom.hex) } |
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
| #!/usr/bin/env ruby | |
| require "httparty" | |
| class Converter | |
| def initialize(filename) | |
| @content = File.open(filename).read | |
| end | |
| attr_reader :content |
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
| #!/usr/bin/env ruby | |
| require 'HTTparty' | |
| require 'nokogiri' | |
| require 'colorize' | |
| require 'action_view' | |
| class Analyzer | |
| def initialize(gem) | |
| @gem = gem |
NewerOlder