Skip to content

Instantly share code, notes, and snippets.

@igniteflow
igniteflow / git_python_current_branch.py
Created February 7, 2012 17:33
GitPython get current active branch
"""
Gets the name of the active Git branch as a string.
Depends on GitPython
pip install GitPython
"""
from git import Repo
repo = Repo('/path/to/your/repo')
branch = repo.active_branch
@mdonkers
mdonkers / server.py
Last active June 25, 2024 18:48
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@ckrybus
ckrybus / 1integrate-django-filter-django-tables2-django-crispy-forms.md
Last active May 13, 2024 05:01
How to integrate django-crispy-forms, django-tables2 and django-filter in order to display a paginated table with filter functionality.
@stevecondylios
stevecondylios / resize-image-in-github-issue-github-flavored-markdown.md
Last active July 9, 2024 20:12
How to Resize an Image in a Github Issue (e.g. Github flavored Markdown)

How to Resize an Image in Github README.md (i.e. Github Flavored Markdown)

Percentage:

<img src="https://user-images.githubusercontent.com/16319829/81180309-2b51f000-8fee-11ea-8a78-ddfe8c3412a7.png" width=50% height=50%>

Pixels:

<img src="https://user-images.githubusercontent.com/16319829/81180309-2b51f000-8fee-11ea-8a78-ddfe8c3412a7.png" width="150" height="280">

@smurching
smurching / parent-and-child-runs.py
Last active February 29, 2024 13:30
creating-child-runs-in-mlflow
import mlflow
# There are two ways to create parent/child runs in MLflow.
# (1) The most common way is to use the fluent
# mlflow.start_run API, passing nested=True:
with mlflow.start_run():
num_trials = 10
mlflow.log_param("num_trials", num_trials)
best_loss = 1e100