A few lines of Ruby with pg
driver
is a simple alternative to a job queuing library.
Job queues are defined as database tables
and workers are defined in one Ruby file.
queuea: bundle exec ruby queue/a.rb
queueb: bundle exec ruby queue/b.rb
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks. | |
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/) | |
(() => { | |
const SHOW_SIDES = false; // color sides of DOM nodes? | |
const COLOR_SURFACE = true; // color tops of DOM nodes? | |
const COLOR_RANDOM = false; // randomise color? | |
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com) | |
const MAX_ROTATION = 180; // set to 360 to rotate all the way round | |
const THICKNESS = 20; // thickness of layers | |
const DISTANCE = 10000; // ¯\\_(ツ)_/¯ |
defmodule Client do | |
def main(pid) do | |
cmd = IO.gets("Enter a command: ") |> String.trim() | |
case String.split(cmd) do | |
["show"] -> | |
key = self() | |
Task.async(fn -> | |
send(pid, {:list, key, self()}) |
/* | |
* MIT License | |
* | |
* Copyright (c) 2023 Fabio Lima | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
A few lines of Ruby with pg
driver
is a simple alternative to a job queuing library.
Job queues are defined as database tables
and workers are defined in one Ruby file.
queuea: bundle exec ruby queue/a.rb
queueb: bundle exec ruby queue/b.rb
module Commands | |
module Meeting | |
AcceptSchema = Dry::Validation.Schema do | |
required(:user_id).filled | |
required(:status).value(eql?: :scheduled) | |
end | |
class Accept < Command | |
def call | |
return validate if validate.failure? |
require 'result/ok' | |
require 'result/error' | |
# | |
# A generic representation of success and failure. | |
# | |
# Styled after the Result monad of Elm and Rust | |
# (or the Either monad of Haskell). | |
# | |
# The `#and_then` method can be used to chain functions that |
-- Enable pl/v8: | |
CREATE EXTENSION plv8; | |
-- Create json history table: | |
CREATE TABLE json_history (id BIGSERIAL PRIMARY KEY, tstamp timestamp DEFAULT now(), table_name text, column_name text, target_id bigint, transform json); | |
-- Create test table: | |
CREATE TABLE test_json (id BIGSERIAL PRIMARY KEY, data JSON); | |
-- Enable history tracking on test_json.data: |
This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt
.
As it is not possible to change the ports used for the standalone
authenticator and I already have a nginx running on port 80/443, I opted to use the webroot
method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com
and example.com
).
For this, I placed config files into etc/letsencrypt/configs
, named after <domain>.conf
. The files are simple:
// A small SSH daemon providing bash sessions | |
// | |
// Server: | |
// cd my/new/dir/ | |
// #generate server keypair | |
// ssh-keygen -t rsa | |
// go get -v . | |
// go run sshd.go | |
// | |
// Client: |
package main | |
import ( | |
"fmt" | |
"os/exec" | |
) | |
type TunnelParams struct { | |
pem_key string | |
ssh_host string |