Skip to content

Instantly share code, notes, and snippets.

@msurguy
msurguy / install.sh
Last active August 30, 2021 21:18
Installing VIPS on Digital Ocean (Ubuntu 14). VIPS (http://www.vips.ecs.soton.ac.uk/) is super fast image processor that performs faster than anything else. Please read the comments for even quicker install
cat ~/.ssh/id_rsa.pub | ssh forge@yourserverIP "cat >> ~/.ssh/authorized_keys"
ssh 'forge@yourserverIP'
mkdir vips
cd vips
wget -c http://www.vips.ecs.soton.ac.uk/supported/current/vips-7.38.5.tar.gz
tar xzvf vips-7.38.5.tar.gz
cd vips-7.38.5/
@whistler
whistler / ofx2csv.py
Created April 19, 2015 23:32
Convert QFX/OFX to CSV
from csv import DictWriter
from glob import glob
from ofxparse import OfxParser
DATE_FORMAT = "%m/%d/%Y"
def write_csv(statement, out_file):
print "Writing: " + out_file
fields = ['date', 'payee', 'debit', 'credit', 'balance']
with open(out_file, 'w') as f:
@kieraneglin
kieraneglin / assert_differences.rb
Created May 27, 2017 04:53
assert_differences
def assert_differences(expression_array, by:, message: nil, &block)
expressions = Array(expression_array)
change_by = Array(by).map(&:to_i)
if expressions.size != change_by.size
raise ArgumentError, 'Each expression must have a corresponding value to change by'
end
exps = expressions.map.with_index do |e, i|
callable = e.respond_to?(:call) ? e : lambda { eval(e, block.binding) }
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@stympy
stympy / app-models-application_record.rb
Created July 16, 2020 20:39
Simple change tracking for Rails models. It also works for non-database-backed models with optional change tracking.
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
include ActivityLogger
end
@brenogazzola
brenogazzola / migrate_im_to_vips.md
Last active March 17, 2024 21:56
Steps to migrate ImageMagick to Libvips

For apps built before the image_processing gem became the default, the migration will involve two steps:

  1. Migrating to the image processing syntax while still using ImageMagick;
  2. Switching to Vips and updating the compression options;

Migrate to the image processing syntax

Before changing from ImageMagick to Vips, it's better to first test the new syntax and ensure everything is still working.

1. Move everything that has to do with compression to a saver hash:

variant(format: :jpg, strip: true, quality: 80)