Skip to content

Instantly share code, notes, and snippets.

View rpbaptist's full-sized avatar

Richard Baptist rpbaptist

  • Rotterdam, Netherlands
View GitHub Profile
@rpbaptist
rpbaptist / xlsx_columns.rb
Last active February 21, 2020 13:09
Spreadsheet column calculation in Ruby
# frozen_string_literal: true
class XlsxColumns
attr_reader :position
ALPHABET = ("A".."Z").to_a
class << self
def column(position)
if position > max_position
raise ArgumentError, "Position must be #{max_position} or lower"
@rpbaptist
rpbaptist / cachable_concern.rb
Last active April 8, 2025 07:10
A cache wrapper implementation with simple interface
# spec/support/shared/examples/cachable.rb
# frozen_string_literal: true
# Provide a simple interface for caching methods
# Usage example:
#
# class Foo
# include Cachable
# cache :bar
@rpbaptist
rpbaptist / aws-download.sh
Created May 19, 2016 10:55
Download all files from AWS S3 from a list generated with AWS CLI
#!/bin/bash
# USE CASE
# I have a bucket with a lot of files and someone else wants to download them.
# They don't have AWS CLI for rsyncing.
# PURPOSE
# It is possible to generate a list of files present in an AWS bucket with the
# AWS CLI:
# aws s3 ls s3://bucket-name/path/ --region eu-west-1 --recursive | tee aws-files.txt