Skip to content

Instantly share code, notes, and snippets.

Avatar
🇵🇹
Learning Portuguese

Bruno Rocha rochacbruno

🇵🇹
Learning Portuguese
View GitHub Profile
View local.dev-config.yml
---
# Pulp Source
pulp_source_dir: "/home/vagrant/devel/pulpcore"
pulp_pip_editable: true
pulp_git_url: https://github.com/pulp/pulpcore.git
pulp_git_revision: "3.11"
# Pulp plugins and Python libs
pulp_install_plugins:
pulp-ansible:
@rochacbruno
rochacbruno / parse_dotenv.bash
Last active Mar 16, 2021 — forked from judy2k/parse_dotenv.bash
Parse a .env (dotenv) file directly using BASH
View parse_dotenv.bash
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
# set variables from .compose.env but don't override existing exported vars
eval "$(grep -v '^#' .compose.env | sed -E 's|^(.+)=(.*)$|export \1=${\1:-\2}|g' | xargs -L 1)"
# Load up .env
View anthony.py
import sys;
class Person: # {
name = "Anthony";
def say_hello(self): # {
return f"Hello, {self.name}";
# };
View app.py
from dynaconf import Dynaconf
settings = Dynaconf(
settings_file="config.toml", # location of config file
environments=[ # available modes/environments
"ansible",
"puppet"
],
envvar_prefix="TEFLO", # prefix for exporting env vars
@rochacbruno
rochacbruno / Makefile
Created Feb 25, 2021 — forked from hugoprudente/Makefile
Makefile with help
View Makefile
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-30s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
View enduser-install-vars.yml
pulp_default_admin_password: password
pulp_install_source: pip
pulp_settings:
secret_key: secret
content_origin: "https://{{ inventory_hostname }}"
x_pulp_api_host: 127.0.0.1
x_pulp_api_port: 24817
x_pulp_api_user: "admin"
x_pulp_api_password: "{{ pulp_default_admin_password }}"
x_pulp_api_prefix: "pulp_ansible/galaxy/automation-hub/api"
View .pdbrc
# from http://stackoverflow.com/questions/1623039/python-debugging-tips
# Ned's .pdbrc
# Print a dictionary, sorted. %1 is the dict, %2 is the prefix for the names.
# alias p_ for k in sorted(%1.keys()): print("%s%-15s= %-80.80s" % ("%2",k,repr(%1[k])))
alias p_ for k in sorted(%1): print("%s%-15s= %-80.80s" % ("%2", k, repr(%1[k]) ))
# Print the instance variables of a thing.
alias pi p_ %1.__dict__ %1.
View split_and_join_proxy_url.py
from urllib3.util import parse_url, Url
proxy_urls = [
(
"http://user:pass@host.com:9090",
{
"scheme": "http",
"url": "host.com",
"username": "user",
@rochacbruno
rochacbruno / README.md
Last active Jun 5, 2021
Vim Configs and CheatSheet
View README.md

VIM CheatSheet

Based on configuration provided in .config/nvim/init.vim

Glossary

  • L = Leader Key, mapped to a single space " "
  • C = Control
  • S = Shift
View countdown.py
"""
Usage:
wait time: 600 (10 minutes)
title: 'Hello World'
duration: 7200 (2 hours)
$ python countdown.py 600 'Titulo da Live' 7200
"""
import os
import sys