Skip to content

Instantly share code, notes, and snippets.

View rochacbruno's full-sized avatar
🛠️
Working on Galaxy_ng and Dynaconf

Bruno Rocha rochacbruno

🛠️
Working on Galaxy_ng and Dynaconf
View GitHub Profile
@rochacbruno
rochacbruno / gist:b02c459d314db31ff77a761732c05aa2
Created September 4, 2023 16:54 — forked from jatcwang/gist:ae3b7019f219b8cdc6798329108c9aee
List of all setxkbmap configuration options (including models/layout/etc)
! model
pc101 Generic 101-key PC
pc102 Generic 102-key (Intl) PC
pc104 Generic 104-key PC
pc105 Generic 105-key (Intl) PC
dell101 Dell 101-key PC
latitude Dell Latitude series laptop
dellm65 Dell Precision M65
everex Everex STEPnote
flexpro Keytronic FlexPro
@rochacbruno
rochacbruno / show_urls.py
Created May 11, 2022 11:16 — forked from andreif/show_urls.py
A command to show urls of a Django project
import sys
from django.core.management import BaseCommand
from django.urls import resolvers
def collect_urls(urls=None, namespace=None, prefix=None):
if urls is None:
urls = resolvers.get_resolver()
prefix = prefix or []
if isinstance(urls, resolvers.URLResolver):
@rochacbruno
rochacbruno / use_pfx_with_requests.py
Created April 6, 2022 21:56 — forked from erikbern/use_pfx_with_requests.py
How to use a .pfx file with Python requests – also works with .p12 files
import contextlib
import OpenSSL.crypto
import os
import requests
import ssl
import tempfile
@contextlib.contextmanager
def pfx_to_pem(pfx_path, pfx_password):
''' Decrypts the .pfx file to be used with requests. '''
{
id: 'gruvbox-dark',
name: 'Gruvbox (Dark)',
highlights: {
background: '#282828',
text: '#ebdbb2',
variable: '#83a598',
attribute: '#8ec07c',
definition: '#fabd2f',
keyword: '#fb4934',
@rochacbruno
rochacbruno / parse_dotenv.bash
Last active March 16, 2021 16:44 — forked from judy2k/parse_dotenv.bash
Parse a .env (dotenv) file directly using 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
@rochacbruno
rochacbruno / Makefile
Created February 25, 2021 21:52 — forked from hugoprudente/Makefile
Makefile with help
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
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"
@rochacbruno
rochacbruno / dummy-web-server.py
Created April 25, 2020 17:14 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python (Updated for Python 3.7)
Usage:
./dummy-web-server.py -h
./dummy-web-server.py -l localhost -p 8000
Send a GET request:
@rochacbruno
rochacbruno / cmus_to_file.sh
Created March 28, 2020 20:23 — forked from joariasl/cmus_to_file.sh
cmus player playing now to temp file from OBS
#!/usr/bin/env sh
file=/tmp/cmus_playing.txt
while true
do
music=""
if cmus-remote -C status | grep -q playing; then
music=$(cmus-remote -Q | grep -e "tag title" -e "tag artist" | sed "s/^tag\s\w*\s//g" | sed "N;s/\n/ - /g")
if (( ${#music} > 0 )); then
music="Now playing: $music"
fi
@rochacbruno
rochacbruno / release_smash.rst
Created June 8, 2018 17:47 — forked from nixocio/release_smash.rst
Release Steps Pulp Smash

Release Goal

The two goals of the release process are to create a tagged commit which bumps the version file and describes changes since the last release, and to generate packages which can be uploaded to PyPI

Objective

This gist describes steps in how to achieve the release goal. There are other ways, but I am familiar with this one described below.

Assumptions