Keynote
- https://statsbot.co
- https://github.com/pact-foundation/pact_broker
- https://detectify.com
- https://www.microfocus.com/en-us/products/static-code-analysis-sast/overview
- https://f5.com/products/modules/global-traffic-manager
class ApiController < ApplicationController | |
before_action :only_respect_accept_header | |
private | |
# By default, Rails will ignore the Accept header if it contains a wildcard | |
# and assume the client wants HTML (or JS if using XMLHttpRequest). See | |
# https://github.com/rails/rails/blob/a807a4f4f95798616a2a85856f77fdfc48da4832/actionpack/lib/action_dispatch/http/mime_negotiation.rb#L171-L173 | |
# | |
# If you don't expect your clients to be browsers, we want to override this |
cask "pdftk" do | |
version "2.02" | |
sha256 "c33cf95151e477953cd57c1ea9c99ebdc29d75f4c9af0d5f947b385995750b0c" | |
url "https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk_server-#{version}-mac_osx-10.11-setup.pkg" | |
name "PDFtk" | |
desc "Tool for doing everyday things with PDF documents" | |
homepage "https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/" | |
pkg "pdftk_server-2.02-mac_osx-10.11-setup.pkg" |
require 'base64' | |
class DataUri | |
REGEXP = %r{ | |
data: | |
(?<mediatype> | |
(?<mimetype> .+? / .+? )? | |
(?<parameters> (?: ; .+? = .+? )* ) | |
)? | |
(?<extension>;base64)? |
#!/bin/bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
# Download all ticked blocklists from The Firebog's "The Big Blocklist | |
# Collection" [0] and block access to them with Unbound by redirecting traffic | |
# to 0.0.0.0. | |
# | |
# [0]: https://firebog.net | |
( |
# A refinement to add methods to Enumerables for calculating the three | |
# Pythagorean means. | |
# | |
# See https://en.wikipedia.org/wiki/Pythagorean_means | |
module PythagoreanMeans | |
# Note that due to a bug refining modules in Ruby 2.7 [1], we can't `refine | |
# Enumerable` so we `refine Array` instead. | |
# | |
# See also https://interblah.net/why-is-nobody-using-refinements |
# Based off chruby's auto.sh: https://github.com/postmodern/chruby#auto-switching | |
unset NODE_AUTO_VERSION | |
function chnode_auto() { | |
local dir="$PWD/" version | |
until [[ -z "$dir" ]]; do | |
dir="${dir%/*}" | |
if { read -r version <"$dir/.node-version"; } 2>/dev/null || [[ -n "$version" ]]; then |
/* | |
* Inspired by Dan Abramov's "Making setInterval Declarative with React Hooks", | |
* this is a custom hook for debouncing a callback (e.g. for click handlers) such | |
* that a callback will not be fired until some delay has passed since the last click. | |
* The callback will automatically be updated with the latest props and state on every | |
* render meaning that users don't need to worry about stale information being used. | |
* | |
* See https://overreacted.io/making-setinterval-declarative-with-react-hooks/ for the | |
* original inspiration. | |
*/ |
On macOS:
$ brew install golang
$ go get github.com/cloudflare/cloudflared/cmd/cloudflared
$ cd ~/go/src/github.com/cloudflare/cloudflared/
$ env GOOS=linux GOARCH=arm GOARM=5 make cloudflared
$ scp cloudflared pi@pi.hole:
Then you can follow the instructions from https://docs.pi-hole.net/guides/dns-over-https/#arm-architecture-raspberry-pi
require 'fibonacci_heap' | |
# Assuming `graph` is an object with the following interface that stores vertices as `FibonacciHeap::Node` | |
# instances and `source` is a `FibonacciHeap::Node`: | |
# | |
# * `graph.vertices`: return an Enumerable of all vertices in the graph | |
# * `graph.neighbours(u)`: return an Enumerable of all vertices that neighbour a given vertex `u` | |
# * `graph.length(u, v)`: return the numeric weight of the edge between two given vertices `u` and `v` | |
def dijkstra(graph, source) | |
dist = Hash.new(Float::INFINITY) |