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
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 '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) |
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
class CircularDoublyLinkedList | |
include Enumerable | |
class Node | |
include Comparable | |
attr_accessor :key, :next, :prev | |
alias right next | |
alias left prev |
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
# A pure Ruby implementation of https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm | |
# | |
# Takes a graph in hash form, e.g. { 'A' => ['B', 'C'], 'B' => ['D'], 'C' => ['D'] }, | |
# and a source node, e.g. 'A', and returns the distances to every reachable node and a hash of "next hops" for each node. | |
def dijkstra(graph, source) | |
q = graph.keys | |
prev = {} | |
dist = Hash.new(Float::INFINITY) | |
dist[source] = 0 |
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
# snitch = Snitch.new('A string') | |
#=> #<Snitch:0x00007fe53a1964b0 @obj="A string"> | |
# snitch.empty? | |
# Calling empty? on A string with [] | |
#=> false | |
class Snitch | |
attr_reader :obj | |
def initialize(obj) |
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
domains = ARGF.readlines.map(&:chomp) | |
queries = domains.map { |domain| %[url_contains:"/#{domain}" OR url_contains:".#{domain}"] } | |
queries.sort_by!(&:size) | |
rule_limit = 1024 | |
operator_limit = 30 | |
rules = [queries.pop] | |
queries.reverse_each do |query| |
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
enum Error { | |
NoRuleApplies, | |
} | |
enum Term { | |
TmTrue, | |
TmFalse, | |
TmIf(Box<Term>, Box<Term>, Box<Term>), | |
TmZero, | |
TmSucc(Box<Term>), |
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
# Declares a new variable, $forwarded_scheme, that contains the URL scheme | |
# used by a user even if Fastly terminates your TLS connections. | |
# | |
# Will use the scheme extracted from the request URI by default or return | |
# "https" if the Fastly-SSL HTTP header is found. | |
map $http_fastly_ssl $forwarded_scheme { | |
default $scheme; | |
"1" "https"; | |
} |
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
Around do |scenario, block| | |
Capybara.using_session(scenario.object_id) do | |
block.call | |
end | |
end |