Skip to content

Instantly share code, notes, and snippets.

View edgabaldi's full-sized avatar
🏠
Working from home

Edgar Gabaldi edgabaldi

🏠
Working from home
View GitHub Profile
@hakib
hakib / admin.py
Last active January 22, 2024 15:18
How to Turn Django Admin Into a Lightweight Dashboard
# https://hakibenita.com/how-to-turn-django-admin-into-a-lightweight-dashboard
from django.contrib import admin
from django.db.models import Count, Sum, Min, Max, DateTimeField
from django.db.models.functions import Trunc
from . import models
def get_next_in_date_hierarchy(request, date_hierarchy):
import sys
from fabric import Connection, task
from invoke import Responder
from fabric.config import Config
PROJECT_NAME = "project_name"
PROJECT_PATH = "~/{}".format(PROJECT_NAME)
REPO_URL = "remote_repo_url"
def get_connection(ctx):
@jabley
jabley / allspaw.md
Last active December 26, 2017 13:36
SREcon preparation reading lists

Writing Post Mortems - John Allspaw

This talk is also known as ‘PostMortem Facilitation: Theory and Practice of "New View" Debriefings’ Background reading for attendees

tmux cheat sheet

Session Control (from the command line)

tmux            Start a new session
tmux attach     Re-attach a detached session
tmux attach -d  Re-attach a detached session (and detach it from elsewhere)

Pane Control

@koenpunt
koenpunt / chosen-bootstrap.css
Last active March 11, 2023 01:01
Bootstrap 3.0 theme for Chosen
select.form-control + .chosen-container.chosen-container-single .chosen-single {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.428571429;
color: #555;
vertical-align: middle;
background-color: #fff;
@iambibhas
iambibhas / django-image-save.py
Created February 27, 2013 21:30
Programatically save ImageField in Django
import requests
from django.core.files import File
from django.core.files.temp import NamedTemporaryFile
def save_image_from_url(model, url):
r = requests.get(url)
img_temp = NamedTemporaryFile(delete=True)