Skip to content

Instantly share code, notes, and snippets.

View rnrbarbosa's full-sized avatar

Roberto Barbosa rnrbarbosa

View GitHub Profile
@rnrbarbosa
rnrbarbosa / main.go
Last active September 7, 2024 16:06
BubbleTea App Boilerplate
func main() {
f, err := tea.LogToFile("cm.log", "debug")
if err != nil {
log.Fatalf("err %w", err)
}
defer f.Close()
app := tea.NewProgram(model{}, tea.WithAltScreen())
if _, err := app.Run(); err != nil {
@rnrbarbosa
rnrbarbosa / bicep-install.sh
Created February 27, 2024 23:32
Bicep CLI Installation
# Fetch the latest Bicep CLI binary
curl -Lo bicep.bin https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64
# Mark it as executable
chmod +x ./bicep.bin
# Add bicep to your PATH (requires admin)
sudo mv ./bicep.bin /usr/local/bin/bicep
# Verify you can now access the 'bicep' command
bicep --help
# Done!
@rnrbarbosa
rnrbarbosa / Options.go
Created February 25, 2024 10:58
BubbleTea Snippets
type MyOption struct {
options []huh.Option[string]
}
func (o *MyOption) Options(options ...huh.Option[string]) {
o.options = options
}
var BurgerList = []string{"Charmburger Classic", "Chickwich", "Fishburger", "Charmpossible™ Burger"}
@rnrbarbosa
rnrbarbosa / cli.py
Created December 23, 2022 22:09
Hydra and Typer together
import hydra
import typer
@hydra.main(config_path='config.yaml')
def my_cli(config):
# Use Typer to define the individual commands and subcommands that your application accepts
@typer.command()
def command1(arg1: str, arg2: int):
# Do something with the arg1 and arg2 arguments
print(arg1, arg2)
@rnrbarbosa
rnrbarbosa / play.py
Created December 23, 2022 21:57
Wrapper to run Ansible Playbooks
import ansible_runner
class AnsiblePlaybookRunner:
def __init__(self, playbook_path, inventory_path=None, options=None, private_data_dir=None):
self.playbook_path = playbook_path
self.inventory_path = inventory_path
self.options = options or {}
self.private_data_dir = private_data_dir
def run(self):
@rnrbarbosa
rnrbarbosa / test_module.py
Created December 23, 2022 21:45
Unit Test for Ansible Module and Plugin
import pytest
from ansible.module_utils.basic import AnsibleModule
from my_plugin import main
@pytest.fixture
def fake_module():
module = ansibleModule(
argument_spec=dict(
name=dict(type='str'),
age=dict(type='int')
primework.ch. 3600 IN TXT "amazonses:Bv9+2PusiAspWUN1jZMytRxfNcRuG0bDYW0lOp+4geM="
primework.ch. 3600 IN TXT "MS=ms23898367"
primework.ch. 3600 IN TXT "v=spf1 include:spf.protection.outlook.com -all ip4:83.150.7.66 ip4:213.188.32.155 ip4:185.49.220.130 ip4:10.60.210.114 include:realisator.ch -all"
primework.ch. 3600 IN MX 0 primework-ch.mail.protection.outlook.com.
primework.ch. 3600 IN A 18.184.147.253
autodiscover.primework.ch. 3600 IN CNAME autodiscover.outlook.com.
sip.primework.ch. 3600 IN CNAME sipdir.online.lync.com.

Flatten a JSON

@rnrbarbosa
rnrbarbosa / 00.VYPER EXAMPLE.md
Last active May 26, 2019 22:09
VYPER EXAMPLE

VYPER EXAMPLE

@rnrbarbosa
rnrbarbosa / 01.Pytest BDD.md
Last active June 2, 2020 20:52
PYTEST EXAMPLE

PYTEST EXAMPLE