Skip to content

Instantly share code, notes, and snippets.

View mat813's full-sized avatar

Mathieu Arnold mat813

View GitHub Profile
@mat813
mat813 / direnv-gitlab-node.sh
Last active November 25, 2023 08:44
Get current node version from .gitlab-ci.yml
use_mynode() {
local file=${1:-.gitlab-ci.yml}
local node_version
watch_file "$file"
# NODE_VERSION: 18.2.0-alpine
node_version=$(sed -n '/NODE_VERSION:/s/NODE_VERSION:[[:space:]]*\([^-]*\)\(-.*\)\?/\1/p' $file)
if [ -z "$node_version" ]; then
const farey = (x: number, N: number): [number, number] => {
if (x > 1) {
const units = Math.floor(x);
const [a, d] = farey(x - units, N);
return [a + units * d, d];
}
let [a, b] = [0, 1];
let [c, d] = [1, 1];
@mat813
mat813 / dns-bind918-Makefile.local
Last active March 21, 2023 11:36
Add flavors to dns/bind918 to automate testing all options.
.if empty(FLAVOR)
FLAVOR= normal
.endif
CONFIGURE_ARGS+= --enable-full-report
.if defined(BIND_TOOLS_SLAVE)
FLAVORS= normal small huge ${OPTIONS_SINGLE_GSSAPI:NGSSAPI_NONE:tl}
. if ${FLAVOR} == small
@mat813
mat813 / gandi.rb
Last active February 22, 2022 16:02
OpenDNSSEC to Gandi
#!/usr/bin/env ruby
# frozen_string_literal: true
# ods-ksmutil key export --keystate ready -t KSK --all | ruby gandi.rb ready
# ods-ksmutil key export --keystate retire -t KSK --all | ruby gandi.rb retire
require 'pp'
require 'rubygems'
require 'dnsruby'
require 'xmlrpc/client'
@mat813
mat813 / afnic.rb
Last active February 22, 2022 16:02
OpenDNSSEC to AFNIC
#!/usr/bin/env ruby
# frozen_string_literal: true
# ods-ksmutil key export --keystate ready -t KSK --all | ruby afnic.rb ready
# ods-ksmutil key export --keystate retire -t KSK --all | ruby afnic.rb retire
require 'pp'
require 'rubygems'
require 'dnsruby'
require 'epp-client/afnic'
@mat813
mat813 / gen_ds.rb
Last active February 22, 2022 16:01
OpenDNSSEC rollover helper
#!/usr/bin/env ruby
# frozen_string_literal: true
# ods-ksmutil key export --keystate XXX -t KSK --all | ruby gen_ds.rb
require 'pp'
require 'rubygems'
require 'dnsruby'
module Dnsruby
@mat813
mat813 / LICENSE
Last active June 8, 2021 15:05
Scripts around acme_tiny to manage keys, requests, certificates...
Copyright (c) 2016 Mathieu Arnold. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
@mat813
mat813 / send-to-encrypted.sh
Created January 7, 2021 12:07
Script to send from an unencrypted zfs pool to an encrypted zfs pool
#!/bin/sh
set -e
set -u
send=$1
receive=$2
echo "from $send"
echo "to $receive"
@mat813
mat813 / batch_stream.js
Created November 9, 2020 16:30
Batch transform stream javascript
const { Transform } = require('stream');
const batchStream = (batchSize = 5) => {
let batch = [];
return new Transform({
objectMode: true,
transform(data, _, done) {
batch.push(data);
module Jekyll
module Filters
def summarize(str, splitstr = /\s*<div id="extended">/)
str.split(splitstr)[0]
end
end
end