Skip to content

Instantly share code, notes, and snippets.

View kimadactyl's full-sized avatar

Dr Kim Foale kimadactyl

View GitHub Profile
@kimadactyl
kimadactyl / words-to-cards.rb
Last active January 15, 2019 17:47
Converting a csv list into a bunch of cards for the Art of Noises boardgame.
require 'rubygems'
require 'RMagick'
require 'csv'
include Magick
$imagepath = 'images/'
cardlist = '../wordlist.csv'
# Function to create all the cards
def create_card(caption)
@kimadactyl
kimadactyl / Calendar from Trello.markdown
Last active August 29, 2015 14:24
Calendar from Trello

Trello-based calendar

For Political Pride 2015. Reads a Trello board and formats for reading as a list. Fairly hacky due to the way I've handled day headings.

Needs a Markdown processor adding.

A Pen by Dr Kim Foale on CodePen.

License.

@kimadactyl
kimadactyl / Gemfile
Created September 24, 2015 18:48
Spree + Minitest + ControllerRequsts isn't happy
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
@kimadactyl
kimadactyl / preview.rb
Created February 18, 2016 19:22
Video previewer. Outputs 10 evenly spaced frames for a directory of videos.
Dir.glob('/YOUR_VIDEOS/*.mp4') do |f|
name = File.basename(f, ".*")
len = `ffprobe #{f} -show_entries format=duration -v quiet -of csv="p=0"`
for n in (1..10)
l = len.to_f / 10 * n
`ffmpeg -i #{f} -ss #{l} -v quiet -vframes 1 './preview/#{name}_#{n}.png'`
end
end
@kimadactyl
kimadactyl / install.md
Last active January 11, 2018 12:30
Ubuntu new installation checklist
@kimadactyl
kimadactyl / Azkfile.js
Last active February 8, 2018 22:59
Adventures in azk
/**
* Documentation: http://docs.azk.io/Azkfile.js
*/
// Adds the systems that shape your system
systems({
'taichi-school': {
// Dependent systems
depends: ["postgres"],
// More images: http://images.azk.io
image: {"docker": "azukiapp/ruby:2.3.0"},

Commands

  • azk deploy ssh -- remote shell
  • azk deploy full -- restart after updating environment variables

Nameserver problems

DNS not resolving

Check /etc/resolver/dev.azk.io equals ip address for docker0

@kimadactyl
kimadactyl / Error log
Created October 19, 2016 10:06
Spree error when progressing to payment
Started PATCH "/shop/checkout/update/address" for 127.0.0.1 at 2016-10-19 11:02:58 +0100
Processing by Spree::CheckoutController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"Wr4CSN3bs2Ft8GeveWat+eKqjkcjR7pOsDZKYtJWncHShITVJjHV+gWaE3pNGzz94nceB/sX0B45MNKcrUvQ7g==", "order"=>{"email"=>"[email protected]", "state_lock_version"=>"2", "bill_address_attributes"=>{"firstname"=>"Kim", "lastname"=>"Foale", "address1"=>"5 Ribston St", "address2"=>"", "city"=>"Manchester", "country_id"=>"77", "zipcode"=>"M15 5RH", "phone"=>"3423423423432", "id"=>"44"}, "use_billing"=>"1", "ship_address_attributes"=>{"id"=>"45"}}, "commit"=>"Save and Continue", "save_user_address"=>"1", "state"=>"address"}
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 136]]
Spree::Store Load (0.3ms) SELECT "spree_stores".* FROM "spree_stores" ORDER BY "spree_stores"."id" ASC LIMIT 1
Spree::Order Load (0.2ms) SELECT "spree_orders".* FROM "spree_orders" WHERE "spree_orders"."comple
@kimadactyl
kimadactyl / royalmail_seeds.rb
Created October 26, 2016 15:24
Create Royal Mail postal regions for Spree
# A couple of helper functions
# This one converts country strings to Spree::Country objects.
def convert_countries(countries)
log = ""
output = []
countries.each do |country|
spree_country = Spree::Country.find_by(name: country)
if spree_country.nil?
spree_country = Spree::Country.find_by("name like ?", "%#{country}%")
@kimadactyl
kimadactyl / README.sh
Last active May 10, 2024 14:23
Dokku / Digital Ocean / Rails / Postgres / Let's Encrypt / persistent storage
# Creating a Digital Ocean droplet running Rails + Postgres with persistant storage and https
#--------------------------------------------------------------------------------------------
# For your ctrl-D pleasure...
# SERVER_IP
# APP_NAME
# RAILS_SECRET (generate with `rails secret`)
# ADMIN_EMAIL