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
# https://github.com/Gerg-L/nix-templates/blob/master/devShell%2Fflake.nix | |
{ | |
inputs = { | |
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | |
}; | |
outputs = | |
{ nixpkgs, ... }: | |
{ | |
devShells.x86_64-linux = | |
let |
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
[nix-shell:~/git/compsci]$ sh install_ruzzy.sh | |
<internal:/home/rwh/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require': libyaml-0.so.2: cannot open shared object file: No such file or directory - /home/rwh/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/x86_64-linux/psych.so (LoadError) | |
from <internal:/home/rwh/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require' | |
from /home/rwh/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/psych.rb:13:in `<top (required)>' | |
from <internal:/home/rwh/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require' | |
from <internal:/home/rwh/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require' | |
from /home/rwh/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/rubygems.rb:608:in `load_yaml' | |
from /home/rwh/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/rubygems/config_file.rb:346:in `load_file' | |
from /home/r |
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 'rbconfig/sizeof' # can we use 64 bit ints? | |
require 'benchmark/ips' | |
require 'bitset' | |
# this should work well up to 64 bits on 64 bit platforms | |
# using native integers | |
# beyond that, Bignums will be generated | |
class BitsInt | |
attr_reader :int |
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 'zlib' | |
require 'digest' | |
require 'openssl' | |
require 'benchmark/ips' | |
DIGESTS = %w[MD5 SHA1 SHA256 SHA384 SHA512 RMD160].map { |name| | |
Digest(name).new | |
} | |
OPENSSL_DIGESTS = %w[SHA1 |
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
[rwh@nixos:~/code/59774592dbaf12d47fa53d0c29c13e6d]$ ruby --version | |
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux] | |
[rwh@nixos:~/code/59774592dbaf12d47fa53d0c29c13e6d]$ ruby test_digest.rb | |
Run options: --seed 50097 | |
# Running: | |
.......... |
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 'bitset' | |
require 'zlib' | |
class BloomFilter | |
# just defaults, overrideable | |
SEED = 0 | |
FPR = 0.01 | |
def self.num_bits(num_items, fpr: FPR) | |
(-1 * num_items * Math.log(fpr) / Math.log(2) ** 2).ceil |
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 'thread' | |
class ThreadInterrupt < RuntimeError; end | |
def try_ip | |
if rand(2).zero? | |
sleep 0.5 | |
true | |
else | |
sleep(rand(5) + 1) |
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
best [:SOCK_STREAM, :SOCK_DGRAM, :SOCK_SEQPACKET] | |
:SOCK_STREAM TYPE SOCK_STREAM | |
:SOCK_DGRAM TYPE SOCK_DGRAM | |
:SOCK_SEQPACKET TYPE SOCK_SEQPACKET | |
other [nil, :SOCK_RAW] | |
nil TYPE SOCK_STREAM | |
:SOCK_RAW TYPE SOCK_DGRAM | |
unsupported [:SOCK_RDM, :SOCK_PACKET, :SOCK_NONBLOCK, :SOCK_CLOEXEC] |
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
# MONITORING: services run on loopback interface | |
# nginx reverse proxy exposes services to network | |
# - grafana:3010 | |
# - prometheus:3020 | |
# - loki:3030 | |
# - promtail:3031 | |
# prometheus: port 3020 (8020) | |
# | |
services.prometheus = { |
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
with import <nixpkgs> {}; | |
with python3Packages; | |
let | |
testing_common_database = buildPythonPackage rec { | |
pname = "testing.common.database"; | |
version = "2.0.3"; | |
src = fetchPypi { | |
inherit pname version; |
NewerOlder