Skip to content

Instantly share code, notes, and snippets.


DSL Boilerplate

We want something like this:

class LakeSuperior
  include LakeDSL

  lake_name 'Lake Superior'
 fish 'trout'
View waft.js
// moved to:
motine / cleanup_job.rb
Last active Apr 22, 2021
Simple Rails Monitoring
View cleanup_job.rb
# services/monitoring/cleanup_service.rb
class Monitoring::CleanupService
Monitoring::Measurement.where("recorded_at < ?", 3.months.ago).delete_all
# let this service run nightly
View biorad.json5
// mind the casing: camelCase
// we use floats and integers not strings
// we use null where appropriate
// in regard to 4. "standardized analysis names": when we define a standard format, let's make sure to also standardize this
// similar for 5. "standardized instrument names": let the homogenization layer take care of this and make sure we define standard names for instrument types
"name": "GE20_RT3168-3171-3173-3175_20200626_JRU_Prof",
"instrument": "LightCycler480",
"instrumentId": 6078,
"instrumentName": "Prof_6078",
motine / gist:8af309be7db58b76eb9b571b703acfa6
Created Jul 15, 2020
View gist:8af309be7db58b76eb9b571b703acfa6
require 'capybara'
require 'capybara/rspec'
# please see notes in
Capybara.server_host = ''
Capybara.server_port = '56556'
Capybara.app_host = 'http://localhost:56556'
Capybara.register_driver(:host_chrome) do |app|
caps ='goog:chromeOptions' => {'w3c' => false}, 'browserName' => 'chrome') # we need to set w3c to false so uploads do work; see and
driver =, browser: :remote, url: 'http://host.docker.internal:9515', desired_capabilities: caps)
motine / Hello.vue
Last active Mar 28, 2020
Rollup multi page bundles
View Hello.vue
<div class="hello">Hello {{ name }}.</div>
export default {
data() { return { name: 'Manfred' } }
View check_lines.rb
BASE_PATH = File.expand_path("~/Repositories/beauty")
above, total = 0, 0
Dir[File.join(BASE_PATH, "**/*.rb")].each do |path|
contents = File.readlines(path)
above += contents.count { |line| line.length > LINE_LENGTH_THRESHOLD }
total += contents.size
motine /
Last active Mar 23, 2016
Matplotlib example (no X needed)
# install: `dnf install python-matplotlib` under Fedora 23
# example inspired by:
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
t = np.arange(0.0, 2.0, 0.01)
s = np.sin(2*np.pi*t)
plt.plot(t, s)
motine /
Last active Oct 12, 2021
Redis Pub/Sub with Python (notes for my collegue)

Redis Pub/Sub with Python


  • Redis supports PUB/SUB
  • It supports pattern matching. Clients may subscribe to glob-style patterns in order to receive all the messages sent to channel names matching a given pattern.


Assuming Fedora 23.

motine / project.c
Last active Sep 18, 2015
use STA to print a number.
View project.c
#include "sketchbook.h"
void setup() {
void draw() {
int result = 77; // this would be your solution
// use the following code to output the result
char buffer[100];
sprintf(buffer, "%i", result);