Skip to content

Instantly share code, notes, and snippets.

View gh640's full-sized avatar

Goto Hayato gh640

View GitHub Profile
gh640 / Dockerfile
Last active February 5, 2022 13:02
Sample: Convert `.mov` file to `.gif` animation
View Dockerfile
FROM ubuntu:latest
RUN apt-get update && \
apt-get install -y ffmpeg && \
rm -rf /var/lib/apt/lists/*
majackson /
Last active January 25, 2024 23:01
Django migrations without downtime

Django Migrations without Downtime

The following instructions describe a set of processes allowing you to run Django database migrations against a production database without having to bring the web service down.

Note that in the below instructions, migrations are all run manually at explicit points, and are not an automatic part of the deployment process.

Adding Fields or Tables

Adding a (nullable) field or a new table

  1. Make the model or column addition in your code.
cobusc /
Last active August 31, 2021 17:32
Protected Media in Django

Protected Media in Django


Django manages media based on the following definitions:

BASE_DIR = /var/praekelt/telkom-spliceworks/
MEDIA_ROOT = "%s/media/" % BASE_DIR
mdonkers /
Last active February 22, 2024 09:54
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
./ [<port>]
from http.server import BaseHTTPRequestHandler, HTTPServer
BretFisher /
Last active February 18, 2024 14:58
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info:

chranderson / nvmCommands.js
Last active February 26, 2024 04:53
Useful NVM commands
View nvmCommands.js
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
colorfield / debug.php
Created February 26, 2016 16:12
Override php.ini for debug on dev environment
View debug.php
// place this in a global script like settings.php in Drupal
ini_set("display_errors", 1);
ini_set("track_errors", 1);
ini_set("html_errors", 1);
douglasmiranda /
Last active January 18, 2024 14:48
Fix: Django Debug Toolbar not showing when using with Docker.
# YOU MAY WANT TO CHECK THIS OUT:{{cookiecutter.django_project_name}}/{{cookiecutter.django_project_name}}/config/
# If you don't do this you will have to add the host IP in INTERNAL_IPS = ('',)
# And it will change, then you will have to change INTERNAL_IPS again.
def show_toolbar(request):
if request.is_ajax():
return False
return True
rxaviers / gist:7360908
Last active February 26, 2024 08:32
Complete list of github markdown emoji markup
View gist:7360908


:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
yyx990803 /
Last active May 4, 2023 19:20
npm list only top level modules.
alias ng="npm list -g --depth=0 2>/dev/null"
alias nl="npm list --depth=0 2>/dev/null"