-i - ignore errors
-c - continue
-t - use video title as file name
--extract-audio - extract audio track
| # Dump | |
| #!/usr/bin/env bash | |
| container=`docker ps | awk '/database/ { print $1 }'` | |
| echo "Dumping data from ${container}" | |
| sudo docker exec -t -u postgres "${container}" pg_dumpall -c -U postgres -l databasename | gzip > dump_`date +%d-%m-%Y"_"%H_%M_%S`.tar.gz | |
| echo "Done!" | |
| # Restore | |
| #!/usr/bin/env bash |
| # | |
| # Wide-open CORS config for nginx | |
| # | |
| location / { | |
| if ($request_method = 'OPTIONS') { | |
| add_header 'Access-Control-Allow-Origin' '*'; | |
| # |
| #!/bin/bash | |
| # Copyright © 2017 Google Inc. | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software |
| # This is just a cheat sheet: | |
| # On production | |
| sudo -u postgres pg_dump database | gzip -9 > database.sql.gz | |
| # On local | |
| scp -C production:~/database.sql.gz | |
| dropdb database && createdb database | |
| gunzip < database.sql.gz | psql database |
| def truncate_db(engine): | |
| # delete all table data (but keep tables) | |
| # we do cleanup before test 'cause if previous test errored, | |
| # DB can contain dust | |
| meta = MetaData(bind=engine, reflect=True) | |
| con = engine.connect() | |
| trans = con.begin() | |
| con.execute('SET FOREIGN_KEY_CHECKS = 0;') | |
| for table in meta.sorted_tables: | |
| con.execute(table.delete()) |
| #!/bin/bash | |
| # https://www.linuxuprising.com/2019/04/how-to-remove-old-snap-versions-to-free.html | |
| # Removes old revisions of snaps | |
| # CLOSE ALL SNAPS BEFORE RUNNING THIS | |
| set -eu | |
| LANG=en_US.UTF-8 snap list --all | awk '/disabled/{print $1, $3}' | | |
| while read snapname revision; do | |
| snap remove "$snapname" --revision="$revision" | |
| done |
To merge exist migration files into one file:
django_migration records table (manually)python manage.py migrate --fake commandpython manage.py makemigrations commandpython manage.py migrate --fake-initial commandpython manage.py migrate contenttypes command