Skip to content

Instantly share code, notes, and snippets.

View eon01's full-sized avatar
🎯
Focusing

Aymen EL Amri eon01

🎯
Focusing
View GitHub Profile
@eon01
eon01 / bootstrap_form_include.html
Last active October 26, 2019 00:31
Django bootstrap includable file for forms with better checkboxes
{% load widget_tweaks %}
{% for hidden_field in form.hidden_fields %}
{{ hidden_field }}
{% endfor %}
{% if form.non_field_errors %}
<div class="alert alert-danger" role="alert">
{% for error in form.non_field_errors %}
{{ error }}
@eon01
eon01 / ansible-nested-variable.yml
Created December 20, 2019 19:15 — forked from enisozgen/ansible-nested-variable.yml
Ansible example which shows how to reach nested variable with dynamic elements
# Example which shows how to reach nested ansible variable which is partially different.
# Run that plabook with ansible-playbook -e "env=test" ansible-nested-variable.yml
---
#
- hosts: localhost
connection : ssh
gather_facts: no
vars:
cidr_blocks:
vpc_production_cidr_block: "10.10.0.0/28"
@eon01
eon01 / views.py
Created March 26, 2020 23:38
A simple view to create a /readiness for Kubernetes probes. Example based on connectivity with DB. It can be customized.
# views.py
# Example inspired by: https://www.ianlewis.org/en/kubernetes-health-checks-django
def readiness(request):
try:
from django.db import connections
for name in connections:
cursor = connections[name].cursor()
cursor.execute("SELECT 1;")
row = cursor.fetchone()
Afghanistan, Aland Islands, Albania, Algeria, American Samoa, Andorra, Angola, Anguilla, Antarctica, Antigua And Barbuda, Argentina, Armenia, Aruba, Australia, Austria, Azerbaijan, Bahamas, Bahrain, Bangladesh, Barbados, Belarus, Belgium, Belize, Benin, Bermuda, Bhutan, Bolivia, Bosnia And Herzegovina, Botswana, Bouvet Island, Brazil, British Indian Ocean Territory, Brunei Darussalam, Bulgaria, Burkina Faso, Burundi, Cambodia, Cameroon, Canada, Cape Verde, Cayman Islands, Central African Republic, Chad, Chile, China, Christmas Island, Cocos (Keeling) Islands, Colombia, Comoros, Republic of Congo, Democratic Republic of Congo, Cook Islands, Costa Rica, Côte d’Ivoire, Croatia, Cuba, Cyprus, Czech Republic, Denmark, Djibouti, Dominica, Dominican Republic, Ecuador, Egypt, El Salvador, Equatorial Guinea, Eritrea, Estonia, Ethiopia, Falkland Islands (Malvinas), Faroe Islands, Fiji, Finland, France, French Guiana, French Polynesia, French Southern Territories, Gabon, Gambia, Georgia, Germany, Ghana, Gibraltar, Greec
@eon01
eon01 / A friendly way to show your Git history
Last active November 6, 2020 15:30
A friendly way to show your Git history
The basic command is:
git log
For a better and less verbose output use:
git log --pretty=oneline
To show only a partial prefix (instead of showing the full commit), use: