Skip to content

Instantly share code, notes, and snippets.

View ogaida's full-sized avatar

Oliver Gaida ogaida

View GitHub Profile
@ogaida
ogaida / jsonFromFullchain.rb
Last active June 30, 2022 20:45
create json from a certificate fullchain.pem
#!/usr/bin/env ruby
require 'openssl'
require "json"
fullchain = ARGV[0]
cmd = %(openssl crl2pkcs7 -nocrl -certfile #{fullchain} | openssl pkcs7 -print_certs)
# if problems with empty lines occur, use this:
# cmd = %(openssl crl2pkcs7 -nocrl -certfile #{fullchain} | openssl pkcs7 -print_certs | perl -pe 's/^\n$//mg; s/-----END CERTIFICATE-----/-----END CERTIFICATE-----\n/' )
@ogaida
ogaida / ress.rb
Last active September 17, 2022 06:09
Alpha Ess Monitoring
#!/usr/bin/ruby
require "json";
class Ress
attr_reader :eload, :feedin, :gridcharge, :ppv, :soc, :userpower, :measure_time, :token_valid_to, :token, :now_s, :now_str
def initialize(sn, u, p)