Skip to content

Instantly share code, notes, and snippets.

View gh640's full-sized avatar
😵

Goto Hayato gh640

😵
View GitHub Profile
@gh640
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
majackson / migrations.md
Last active January 25, 2024 23:01
Django migrations without downtime
View migrations.md

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
cobusc / protected_media.md
Last active August 31, 2021 17:32
Protected Media in Django
View protected_media.md

Protected Media in Django

Introduction

Django manages media based on the following definitions:

BASE_DIR = /var/praekelt/telkom-spliceworks/
MEDIA_ROOT = "%s/media/" % BASE_DIR
@mdonkers
mdonkers / server.py
Last active February 22, 2024 09:54
Simple Python 3 HTTP server for logging all GET and POST requests
View server.py
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@BretFisher
BretFisher / docker-for-mac.md
Last active February 18, 2024 14:58
Getting a Shell in the Docker Desktop Mac VM
View docker-for-mac.md

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: https://github.com/justincormack/nsenter1


@chranderson
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
colorfield / debug.php
Created February 26, 2016 16:12
Override php.ini for debug on dev environment
View debug.php
<?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);
error_reporting(E_ALL);
@douglasmiranda
douglasmiranda / option1.py
Last active January 18, 2024 14:48
Fix: Django Debug Toolbar not showing when using with Docker.
View option1.py
# YOU MAY WANT TO CHECK THIS OUT: https://github.com/douglasmiranda/ddpt/blob/master/{{cookiecutter.django_project_name}}/{{cookiecutter.django_project_name}}/config/local.py
# If you don't do this you will have to add the host IP in INTERNAL_IPS = ('127.0.0.1',)
# 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
rxaviers / gist:7360908
Last active February 26, 2024 08:32
Complete list of github markdown emoji markup
View gist:7360908

People

: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
yyx990803 / nl.sh
Last active May 4, 2023 19:20
npm list only top level modules.
View nl.sh
alias ng="npm list -g --depth=0 2>/dev/null"
alias nl="npm list --depth=0 2>/dev/null"