Skip to content

Instantly share code, notes, and snippets.

View luzfcb's full-sized avatar

Fábio C. Barrionuevo da Luz luzfcb

View GitHub Profile
@audreyfeldroy
audreyfeldroy / pypi-release-checklist2.md
Last active February 6, 2025 20:00
My PyPI Release Checklist 2 (now with bumpversion)
  • Update HISTORY.rst
  • Commit the changes:
git add HISTORY.rst
git commit -m "Changelog for upcoming release 0.1.1."
  • Update version number (can also be patch or major)
bumpversion minor
@antitoxic
antitoxic / reverseadmin.py
Last active May 29, 2024 10:47 — forked from joshkel/reverseadmin.py
Ability to embed OneToOne relationships as inline forms for parent model in django admin
'''
adminreverse from here http://djangosnippets.org/snippets/2032/
changed for working with ForeignKeys and updated for Django 1.8
via: https://gist.github.com/joshkel/d051b329501273967506
'''
'''
reverseadmin
============
Module that makes django admin handle OneToOneFields in a better way.
@cuducos
cuducos / bootstrap.sh
Last active August 9, 2019 02:07
Computer Bootstraps
#!/bin/bash
##############################################################################
# Install system packages #
##############################################################################
xcode-select --install
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
# install homebrew
@edgabaldi
edgabaldi / readonly.py
Created July 16, 2015 02:31
ReadOnlyFieldsMixin
from django.utils import six
from django.utils.encoding import force_str
class ReadOnlyFieldsMixin(object):
readonly_fields = ()
def __init__(self, *args, **kwargs):
super(ReadOnlyFieldsMixin, self).__init__(*args, **kwargs)
self.define_readonly_fields(self.fields)
@drgarcia1986
drgarcia1986 / blocking_to_async.py
Last active November 13, 2016 15:24
Calling a blocking task asynchronously in Tornado with ThreadPoolExecutor
# -*- coding: utf-8 -*-
import time
import concurrent.futures
import tornado.web
import tornado.gen
import tornado.httpserver
import tornado.ioloop
@edgabaldi
edgabaldi / round_decimal.py
Last active August 29, 2015 14:23
Round Decimal
>>> from decimal import Decimal
>>> Decimal('2.14999').quantize(Decimal('0.00'))
Decimal('2.15')
@blueyed
blueyed / test_django_data_migration.py
Last active December 9, 2020 16:20
Test Django data migrations
"""
Test (data) migrations in Django.
This uses py.test/pytest-django (the `transactional_db` fixture comes from there),
but could be easily adopted for Django's testrunner:
from django.test.testcases import TransactionTestCase
class FooTestcase(TransactionTestCase):
def test_with_django(self):
@shacker
shacker / gist:87908e13c9ee6655ce90
Last active July 17, 2024 14:55
Using the Workday API with Python and the suds client library
import sys
from suds import client
from suds.wsse import Security, UsernameToken
from suds.sax.text import Raw
from suds.sudsobject import asdict
from suds import WebFault
'''
Given a Workday Employee_ID, returns the last name of that employee.
@twidi
twidi / ._README.md
Last active April 10, 2023 06:24
Pycharm and virtualenvwrapper, with postactivate

The problem

PyCharm has support for virtual environment.

But there are two problems:

  1. the virtual environment is not activated in the terminal (it is only in the python console)
  2. it doesn't support virtualenvwrapper and so doesn't run the postactivate file.

This gist is the solution I found to resolve these two problems.

@rochacbruno
rochacbruno / mainpython.md
Last active July 22, 2024 19:03
Use of __main__.py

The use of __main__.py to create executables

myprojectfolder/
    |_ __main__.py
    |_ __init__.py

Being __main__.py:

print("Hello")