Skip to content

Instantly share code, notes, and snippets.

View t0rik's full-sized avatar
🏠
Working from home

Vadym t0rik

🏠
Working from home
View GitHub Profile
@t0rik
t0rik / pg_backup_all.sh
Created June 13, 2023 09:35 — forked from powellc/pg_backup_all.sh
Bash script to backup all postgresql databases on a server, run with cron once a day or 5 times a day, whatever. Just updated it so it ignores your postgres db, and also bzips the backups and adds a symlink to a latest directory. Sweet.
#!/bin/bash
# Location to place backups.
backup_dir="/var/backups/databases/"
nightly_dir="/var/backups/databases/latest/"
#String to append to the name of the backup files
backup_date=`date +%d-%m-%Y`
#Numbers of days you want to keep copie of your databases
number_of_days=15
databases=`psql -l -t | cut -d'|' -f1 | sed -e 's/ //g' -e '/^$/d'`
for i in $databases; do if [ "$i" != "postgres" ] && [ "$i" != "template0" ] && [ "$i" != "template1" ] && [ "$i" != "template_postgis" ]; then
@t0rik
t0rik / script.sh
Created March 3, 2023 15:26 — forked from vielhuber/script.sh
PostgreSQL: Backup and restore export import pg_dump with password on command line #sql
# best practice: linux
nano ~/.pgpass
*:5432:*:username:password
chmod 0600 ~/.pgpass
# best practice: windows
edit %APPDATA%\postgresql\pgpass.conf
*:5432:*:username:password
# linux
@t0rik
t0rik / Drupal 8 on VestaCP.md
Created July 26, 2022 05:59 — forked from m4tlch/Drupal 8 on VestaCP.md
Templates for Drupal 8 on VestaCP

Each file should be put in /usr/local/vesta/data/templates/web/apache2

Then, when you edit your domain/site, you can change the web template to Drupal8 and just upload your whole project into public_html

@t0rik
t0rik / .htaccess
Created April 13, 2021 11:32 — forked from alexsasharegan/.htaccess
Apache Config for React Router
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
@t0rik
t0rik / drupal_8_twig_cheatsheet.md
Created November 20, 2020 13:42 — forked from raphaellarrinaga/drupal_8_twig_cheatsheet.md
[Drupal 8 Twig cheatsheet] #tags: drupal8, twig, cheatsheet

Drupal 8 Twig cheatsheet

Getting Drupal 8 field values in Twig

Image path: {{ file_url(content.field_name['#items'].entity.uri.value) }}

Image title text: {{ node.field_name.title }}

Entity Reference path: {{ content.field_tags[0]['#url'] }}