Skip to content

Instantly share code, notes, and snippets.

View qcoumes's full-sized avatar

C. Quentin qcoumes

  • Codoc
  • France
  • 14:34 (UTC +02:00)
View GitHub Profile
@qcoumes
qcoumes / pytest_mute_signals_fixture.py
Last active April 17, 2024 15:56
This fixture disable django's signals in every test. You can indiviually enable them for a function using '@pytest.mark.enable_signals' decorator or for a file using 'pytestmark = pytest.mark.enable_signals'
@pytest.fixture(autouse=True)
def mute_signals(request):
# Skip applying, if marked with `enabled_signals`
if 'enable_signals' in request.keywords:
return
signals = [pre_save, post_save, pre_delete, post_delete, m2m_changed]
restore = {}
for signal in signals:
restore[signal] = signal.receivers
@qcoumes
qcoumes / git_prompt.sh
Last active October 1, 2020 15:48
Change prompt to '[host] [time] [pwd] $' and '[time] [pwd] ([branch]) $' when inside a git repository
curl -L https://gist.githubusercontent.com/qcoumes/631aafe1951910c623dde57bede4f7b4/raw/7021c5daf3a06a24d9f2fc4da554af84a1719cda/bash_git > ~/.bash_git
source ~/.bash_git
echo "source ~/.bash_git" >> ~/.bashrc
echo "export PS1='\[\033[0;35m\]\h \[\033[0;33m\]\t \[\033[0;36m\]\w\[\033[0;1;91m\]\$(__git_ps1)\[\033[0;32m\] \$\[\033[0;0m\] '" >> ~/.bashrc
source ~/.bashrc
@qcoumes
qcoumes / GodDrinksJava.java
Last active September 16, 2019 10:10
The program GodDrinksJava implements an application that creates an empty simulated world with no meaning or purpose.
package goddrinksjava;
/**
* The program GodDrinksJava implements an application that
* creates an empty simulated world with no meaning or purpose.
*
* @author momocashew
*/