Skip to content

Instantly share code, notes, and snippets.

Avatar
🍍

Anas Abou Allaban piraka9011

🍍
View GitHub Profile
@piraka9011
piraka9011 / sentry_filter.py
Last active Mar 16, 2022
How to filter Sentry transactions for Django + Celery
View sentry_filter.py
"""This is a full example of a trace sampler that filters transactions for:
1. Django views/routes/urls (whatever you want to call them)
2. Celery tasks
Generally, you would put this in your `settings.py` file, but you can put format it as needed for your project of course.
We are assuming you use `django-environ` for secrets management.
"""
import environ
import sentry_sdk
@piraka9011
piraka9011 / check_wave_audio.py
Created Dec 22, 2019
Check if file can be read with python wave module
View check_wave_audio.py
import os
import wave
if __name__ == '__main__':
directory = '/Users/allabana/tarteel_ws/tarteel-recordings/media'
(_, _, filenames) = next(os.walk(directory))
bad_files = []
for filename in filenames:
wave_filename = os.path.join(directory, filename)
try:
View keybase.md

Keybase proof

I hereby claim:

  • I am piraka9011 on github.
  • I am piraka9011 (https://keybase.io/piraka9011) on keybase.
  • I have a public key ASDd9K7I5IP02lGwyyIffqaVXQhE-pXhF2nMYj5vjT9xMQo

To claim this, I am signing this object:

View how-to-squash-commits-in-git.md

Squashing Git Commits

The easy and flexible way

This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).

Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.

Switch to the master branch and make sure you are up to date:

View keybase.md

Keybase proof

I hereby claim:

  • I am piraka9011 on github.
  • I am anas9011 (https://keybase.io/anas9011) on keybase.
  • I have a public key ASBLGr_u2a5g4MlUaPfS835crKpGOAQENQLV0UlsVqjYcQo

To claim this, I am signing this object: