Skip to content

Instantly share code, notes, and snippets.

View ogaida's full-sized avatar

Oliver Gaida ogaida

View GitHub Profile
@ogaida
ogaida / parent_playbook.yml
Last active June 4, 2024 20:57
set hosts via hosts variable
---
- name: execute playbook_debug.yml
import_playbook: playbook_debug.yml
vars:
hosts: ':&~f\d.*-imap00\d$'
@ogaida
ogaida / .bashrc
Last active June 4, 2024 21:00
fzf mail.log
function fzf_maillog(){
logfile=$1
cat ${logfile}|fzf -i -e --preview="grep -F \$(awk '{print \$6}' {+f}) ${logfile}" --preview-window=up:50%:wrap -m --bind ctrl-t:toggle-all
}
@ogaida
ogaida / csv_calc.sh
Created June 1, 2024 13:49
csv preview with fzf
#!/usr/bin/env bash
file=$1
iconv --from-code=ISO-8859-1 --to-code=UTF-8 $file | \
mlr --icsv --ifs ';' --omd cat| \
fzf -e -i --preview="echo {}|tr '|' '\n'" -m --bind ctrl-o:select-all | \
awk -F'|' '{sum += $9}END{print sum}'
# requirements: mlr (miller), fzf (fuzzy finder), iconv (convert codesets)
@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)