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 / 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

@rochacbruno
rochacbruno / swagger-ui-config.js
Created May 18, 2018 23:03 — forked from miguelmota/swagger-ui-config.js
Swagger UI set scheme to window location protocol
window.onload = function() {
fetch('./swagger.json')
.then(function(response) {
response.json()
.then(function(json) {
json.schemes[0] = window.location.protocol.slice(0, -1)
json.host = window.location.host
const ui = SwaggerUIBundle({
spec: json,
@rochacbruno
rochacbruno / example.py
Created May 14, 2018 13:34 — forked from danilobellini/example.py
A really simple/incomplete bottle/flask-like "single blocking worker thread" web server implementation (Python 2)
from server import WebServer
app = WebServer()
@app.route("/")
def root():
return "Hello World!"
@app.route("/file")
def file_route():
with open("server.py", "rb") as f:
@rochacbruno
rochacbruno / App.md
Last active April 10, 2020 15:59 — forked from dunossauro/app_1.py
Flask merge route example
$ pip3 install flask
$ export FLASK_APP=manage.py

$ flask routes
$ flask run
$ flask shell
@rochacbruno
rochacbruno / gist:91e7b94d46f14c0bca26d60cd7844271
Created April 13, 2018 16:22 — forked from danielestevez/gist:2044589
GIT Commit to an existing Tag
1) Create a branch with the tag
git branch {tagname}-branch {tagname}
git checkout {tagname}-branch
2) Include the fix manually if it's just a change ....
git add .
git ci -m "Fix included"
or cherry-pick the commit, whatever is easier
git cherry-pick {num_commit}
@rochacbruno
rochacbruno / generate-hosts.rb
Created March 28, 2018 21:54 — forked from johnpmitsch/generate-hosts.rb
proxy generate virt hosts apache
#!/usr/bin/env ruby
base=50000 #port
range="192.168.121."
contents = <<-EOS
Listen %{port} https
<VirtualHost *:%{port}>
ProxyPass / https://%{ip_address}/
<Location />
@rochacbruno
rochacbruno / LICENSE
Created July 25, 2017 13:30 — forked from ncoghlan/LICENSE
Auto-defined named tuples in Python 3.6+
Copyright 2017 Nicholas Coghlan. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other materials
@rochacbruno
rochacbruno / README.md
Created May 12, 2017 13:39 — forked from omaciel/README.md
Some simple code to show the differences between using namedtuple from the collections module and NamedTuple from the typing module. Extra points for using type hinting.

Playing with named tuples

Some simple code to show the differences between using namedtuple from the collections module and NamedTuple from the typing module. Extra points for using type hinting.

Using namedtuple from the collections module:

>>> from platforms_namedtuple_35 import *
>>> system_1 = RHEL7
>>> system_2 = RHEL5
!#/usr/bin/python
import mechanize
import getpass
import time
import os
def reload(username=None, password=None, domain=None):
if username is None:
username = raw_input('Username: ')
@rochacbruno
rochacbruno / generic_json.py
Created March 29, 2017 14:41 — forked from jsbueno/generic_json.py
Helpers to serialize/de-serialize generic Python objects as JSON
"""Custom JSON encoder and Decoder classes to work with general Python classes
Pass these as the `cls` argument to json.dump and json.load to enable
the serialization of most Python defined "well behaved" objects
directly as JSON.
Ref.: http://stackoverflow.com/questions/43092113/create-a-class-that-support-json-serialization-for-use-with-celery/43093361#43093361
"""
import json