Skip to content

Instantly share code, notes, and snippets.

View douglasmiranda's full-sized avatar
👽

Douglas Miranda douglasmiranda

👽
  • Earth, Brazil
View GitHub Profile
@douglasmiranda
douglasmiranda / toasts.css
Last active December 8, 2022 19:29
Bootstrap Toasts - Top Right Fixed (+ Fix toast-container overlaping content)
/* https://getbootstrap.com/docs/5.0/components/toasts/ */
.toast-container {
position: fixed;
right: 20px;
top: 20px;
}
.toast:not(.showing):not(.show) {
display: none !important;
@douglasmiranda
douglasmiranda / drone.md
Created November 26, 2018 22:59
Status: how Drone deals with monorepo; dir/file changed conditions

Well there's no builtin way of doing.

The problem is:

We need a way of skipping steps, or conditional pipelines that are triggered when some dir/* files.* were changed since last commit.

Useful if you maintain a:

  • Monorepo
@douglasmiranda
douglasmiranda / forms.py
Created July 17, 2012 17:46
Implementando form de filtro numa ListView (Resposta para um tópico na Django Brasil)
# https://groups.google.com/forum/?fromgroups#!topic/django-brasil/d6gV1V9qrgU
from django.forms import ModelForm
from minha_app.models import MeuModel
class MeuForm(ModelForm):
class Meta:
model = MeuModel
@douglasmiranda
douglasmiranda / docker-aarch64.md
Last active June 1, 2022 10:55
Packaging Docker aarch64 for Debian Stretch. (On Packet.net)

Deploy a server to packet.net

Type 2A - Ubuntu 17.04

ssh into it.

Install Docker. (Yes we use Docker to build Docker)

This is a old docker, but It's good for us. apt install docker.io

@douglasmiranda
douglasmiranda / gist:5408278
Created April 17, 2013 22:26
Leading zeros in django templates
{{ variable|stringformat:"02d" }}
@douglasmiranda
douglasmiranda / mb_substr.php
Created August 24, 2011 20:38
How to get substring from accented words (UTF-8)
<?php
/**
* How to get substring UTF-8 characters
*/
// If you try something like this
$utf_8_characters = 'Sábado';
echo substr($utf_8_characters, 0, 3);
// you get something like "Sá", but not "Sáb"
@douglasmiranda
douglasmiranda / Makefile
Created September 19, 2017 22:16
Makefile - read input and export variable.
_build:
# ...
export IMAGE
build: ## build images / see `make available_images` for a list of images
@read -p "Enter image name: " IMAGE; $(MAKE) _build
@douglasmiranda
douglasmiranda / fix.md
Last active October 26, 2021 11:26
Docker Registry (Distribution) + Minio/s3: fix the "Retrying in X seconds" | failed with status: 503 Service Unavailable
@douglasmiranda
douglasmiranda / ansible.md
Last active September 12, 2021 15:13
Ansible: Notes, Errors and Solutions

Ansible for Configuration Management

I'm using Ansible only for Configuration Management, the server is up and I want to configure users, install packages and configure them.

For infrastructure provisioning terraform.io is nice!

Currently, my deployment flow includes Drone.io/GitlabCI for CI/CD and Docker Swarm for orchestrating containers.

@douglasmiranda
douglasmiranda / admin.py
Created January 12, 2021 22:02
Django Admin Inline / Access parent object/instance of an Inline
# Let's say you want to access the Collection instance for a Image in a Django Admin Inline
from django.contrib import admin
from app.models import Image, Collection
class ImageInline(admin.StackedInline):
model = models.Image
extra = 1