Skip to content

Instantly share code, notes, and snippets.

View edardev's full-sized avatar
💭
I may be slow to respond.

Edward Almanzar edardev

💭
I may be slow to respond.
View GitHub Profile
@jorool
jorool / gist:57714bcdc06953531749
Last active December 24, 2021 00:11
Powershell script to download images from multiple urls
$images = 'https://foo.jpg', 'https://bar.jpg'
$targetDir = 'C:\foo\bar'
function DownloadFile([Object[]] $sourceFiles,[string]$targetDirectory) {
$wc = New-Object System.Net.WebClient
foreach ($sourceFile in $sourceFiles){
$sourceFileName = $sourceFile.SubString($sourceFile.LastIndexOf('/')+1)
$targetFileName = $targetDirectory + $sourceFileName
$wc.DownloadFile($sourceFile, $targetFileName)

Backup and Restore Postgres databases

https://www.postgresqltutorial.com/postgresql-backup-database/

Backup a specific database use pg_dump

docker exec -t your-db-container pg_dump -U strapi -W -F t database-name > mypostgres_strapi_`date +%d-%m-%Y"_"%H_%M_%S`.sql

Backup all databases use pg_dumpall

docker exec -t your-db-container pg_dumpall -c -U postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql

Strapi, Hasura Postgres and pgAdmin4 with docker-compose