In order to enable debugging for your Django app running in a Docker container, follow these steps using Visual Studio (Code):
- Add
ptvsd
to your requirements.txt file
ptvsd == 4.3.2
- To your
launch.json
, add this:
/* | |
* Copyright (c) 2013 Calvin Rien | |
* | |
* Based on the JSON parser by Patrick van Bergen | |
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html | |
* | |
* Simplified it so that it doesn't throw exceptions | |
* and can be used in Unity iPhone with maximum code stripping. | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining |
@echo off | |
set username=DosAmp | |
cd /D %appdata%\.minecraft | |
start javaw -Xms512m -Xmx1024m -cp bin/lwjgl.jar;bin/lwjgl_util.jar;bin/jinput.jar;bin/minecraft.jar -Djava.library.path="%appdata%\.minecraft\bin\natives" net.minecraft.client.Minecraft "%username%" |
#based on po75558Manuel Patrone comment on https://forums.docker.com/t/how-can-i-ssh-into-the-betas-mobylinuxvm/10991/8 | |
#get a privileged container with access to Docker daemon | |
docker run --privileged -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker alpine sh | |
#run a container with full root access to MobyLinuxVM and no seccomp profile (so you can mount stuff) | |
docker run --net=host --ipc=host --uts=host --pid=host -it --security-opt=seccomp=unconfined --privileged --rm -v /:/host alpine /bin/sh | |
#switch to host FS | |
chroot /host |
from functools import partial | |
import pydantic | |
import logging | |
from django.contrib.postgres.fields import JSONField | |
from typing import Type, Union, Tuple | |
from django.core.serializers.json import DjangoJSONEncoder |
This guide will enable systemd
to run as normal under WSL 2. This will enable services like microk8s
, docker
and many more to just work
during a WSL session. Note: this was tested on Windows 10 Build 2004, running Ubuntu 20.04 LTS in WSL 2.
To enable systemd
under WSL we require a tool called systemd-genie
Copy the contents of install-sg.sh
to a new file /tmp/install-sg.sh
:
Review all steps to view the symptom this Gist addresses, customize a workaround to allow for >256GB Docker pulls safely on Windows, then perform a backup and recovery of the result (export and import). Please provide comments on any failures.
docker system df
docker system df
using System; | |
using System.Collections.Concurrent; | |
namespace ns | |
{ | |
//even though this looks like it only takes functions with one input | |
// by using C# tuple types, one can have any number of inputs (or outputs) | |
// see example below | |
public class Memoized<T, TResult> | |
{ |
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks. | |
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/) | |
(() => { | |
const SHOW_SIDES = false; // color sides of DOM nodes? | |
const COLOR_SURFACE = true; // color tops of DOM nodes? | |
const COLOR_RANDOM = false; // randomise color? | |
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com) | |
const MAX_ROTATION = 180; // set to 360 to rotate all the way round | |
const THICKNESS = 20; // thickness of layers | |
const DISTANCE = 10000; // ¯\\_(ツ)_/¯ |