This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule NodeProcess.Application do | |
# See https://hexdocs.pm/elixir/Application.html | |
# for more information on OTP Applications | |
@moduledoc false | |
use Application | |
def start(_type, _args) do | |
# List all child processes to be supervised | |
children = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
"$@" & | |
pid=$! | |
while read line ; do | |
echo line | |
done | |
kill -KILL $pid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule NodeProcess.Server do | |
@moduledoc """ | |
A GenServer implementation that starts a Node.js server process using Elixir ports. | |
""" | |
# Elixir automatically defines callbacks not overriden | |
use GenServer | |
@doc """ | |
Called when application started via application.ex. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ambient Experiment | |
# Coded by Darin Wilson | |
# | |
# The piece consists of three long loops, each of which | |
# plays one of two randomly selected pitches. Each note | |
# has different attack, release and sleep values, so that | |
# they move in and out of phase with each other. This can | |
# play for quite awhile without repeating itself :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"info": { | |
"title": "Account and Transaction API Specification", | |
"description": "Swagger for Account and Transaction API Specification", | |
"termsOfService": "https://www.openbanking.org.uk/terms", | |
"contact": { | |
"name": "Service Desk", | |
"email": "ServiceDesk@openbanking.org.uk" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'openregister-ruby' | |
c = OpenRegister.register('country', :beta)._all_records + | |
OpenRegister.register('territory', :alpha)._all_records | |
c.select{|x| x.end_date.blank?}.map(&:name).sort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'graph' # gem 'graph' | |
require 'openregister-ruby' # gem 'openregister-ruby', git: 'https://github.com/robmckinnon/openregister-ruby.git', branch: 'record-versions' | |
r = OpenRegister.register 'school-eng', :alpha | |
digraph do | |
rotate | |
node_attribs << rectangle | |
r._fields.each do |f| | |
if f.register.present? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mix run -e 'stream = "x\ny" |> String.split() |> Stream.map(& &1); | |
IO.puts inspect stream |> Enum.at(0); | |
IO.puts inspect stream |> Enum.at(0);' | |
"x" | |
"x" | |
(echo x && echo y) | mix run -e 'stream = IO.stream(:stdio, :line); | |
IO.puts inspect stream |> Enum.at(0); | |
IO.puts inspect stream |> Enum.at(0);' | |
"x\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem install base32-crockford | |
irb | |
require 'base32/crockford' | |
Base32::Crockford.encode(10033530330) | |
=> "9B0Q1ET" | |
exit | |
cd address-data/data/address | |
grep 9B0Q1ET *.tsv | |
TQ258.tsv:2003-04-27T00:00:00Z 9B0Q1ET 8400765 GROUND FLOOR AND FIRST FLOOR [-0.1364013,51.5173220] 2015-04-20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`mkdir data` | |
%w[uk | |
street | |
school | |
school-type | |
school-tag | |
school-phase | |
school-gender | |
school-federation | |
school-admissions-policy |