Skip to content

Instantly share code, notes, and snippets.

View danielmartins's full-sized avatar

Daniel Martins danielmartins

View GitHub Profile
@palewire
palewire / README.md
Last active April 17, 2025 17:18
How to push tagged Docker releases to Google Artifact Registry with a GitHub Action

How to push tagged Docker releases to Google Artifact Registry with a GitHub Action

Here's how I configured a GitHub Action so that a new version issued by GitHub's release interface will build a Dockerfile, tag it with the version number and upload it to Google Artifact Registry.

Before you attempt the steps below, you need the following:

  • A GitHub repository that contains a working Dockerfile
  • The Google Cloud SDK tool gcloud installed and authenticated

Create a Workload Identity Federation

@cb109
cb109 / forms.py
Last active September 25, 2024 08:02
Reusing the Django Admin AutocompleteSelect Widget in a custom Template
from typing import Iterable
from typing import Optional
from django.contrib import admin
from django.contrib.admin.widgets import AutocompleteSelect
from django.forms import ModelChoiceField
from myproject.myapp.models import MyCustomModel

redis-cli with TLS

This guide shows you how to connect to a remote secure Redis instance via local.

Note: PROCEED WITH EXTREME CAUTION UNDER THE ASSUMPTION THAT YOU ARE CONNECTING TO A PROUDCTION LEVEL REDIS INSTANCE

Pre-reqs

@npearce
npearce / install-docker.md
Last active April 26, 2025 04:27
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@nigma
nigma / serve.py
Created December 20, 2012 22:44
Serving Django with CherryPy
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import webbrowser
from threading import Timer
os.environ["DJANGO_SETTINGS_MODULE"] = "webapp.settings"
import cherrypy