Skip to content

Instantly share code, notes, and snippets.

@barbietunnie
barbietunnie / redis-misconf-error.md
Created September 6, 2023 17:35
How to resolve MISCONF Redis is configured to save RDB snapshots error

How to resolve MISCONF Redis is configured to save RDB snapshots error

The error "MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error" occurs when Redis tries to save the database in the background but fails.

One of the scenarios where it's known to happen is when redis was recently upgraded by homebrew.

To resolve the issue, ssimply restart your redis instance:

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@barbietunnie
barbietunnie / ansible-variable-precedence.md
Last active March 19, 2023 20:25
Ansible Variable Precedence

Ansible Variable Precedence

Here is the order of precedence from least to greatest (the last listed variables override all other variables):

  1. command line values (for example, -u my_user, these are not variables)
  2. role defaults (defined in role/defaults/main.yml) [1]
  3. inventory file or script group vars [2]
  4. inventory group_vars/all [3]
  5. playbook group_vars/all [3]
  6. inventory group_vars/* [3]
@barbietunnie
barbietunnie / config.py
Last active December 7, 2022 00:11
Working with relative paths in Python
import os
ROOT_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), '..'))
@barbietunnie
barbietunnie / nginx-headers-underscore.md
Created December 6, 2022 04:10
How to fix – NGINX not accepting headers with underscore

How to fix – Nginx not accepting headers with underscore

Although headers with underscore are perfectly valid according to HTTP standards, however NGINX does not support it by default. To enable NGINX to accept headers with underscore, add the following directive within the server block of your NGINX configuration.

underscores_in_headers on;

Validate and reload the configuration after making this change as follows:

@barbietunnie
barbietunnie / user-group-daemon.md
Created December 6, 2022 02:43
How to determine the user and group of a daemon in Ubuntu

How to determine the user and group of a daemon in Ubuntu

The situation occasionally arises when you need to determine the user and group a daemon such as nginx is running as on Ubuntu, you can basically run the following command:

ps aux|grep nginx|grep -v grep
@barbietunnie
barbietunnie / django-secret-key.py
Created December 5, 2022 04:06
How to generate a Django `SECRET_KEY`
from django.core.management.utils import get_random_secret_key
print(get_random_secret_key())
@barbietunnie
barbietunnie / file-contents-dump-ansible.md
Created November 25, 2022 12:09
How to dump file contents to console with Ansible

How to dump file contents to console with Ansible

-  name: Display content of resolv.conf
  hosts: localhost
  tasks:
    - name: Display resolv.conf contents
      command: cat resolv.conf chdir=/etc
      register: command_output
@barbietunnie
barbietunnie / custom-fonts-taliwindcss-nextjs.md
Last active April 17, 2024 19:40
How to Use Custom Fonts in TailwindCSS + NextJS

How to Use Custom Fonts in TailwindCSS + NextJS

Assuming your have already set up your NextJS + Tailwind project,

1. Select your desired custom Google font

2. Scroll to the bottom and select all the styles you are interested in

Select all your desired styles

@barbietunnie
barbietunnie / restart-postgres-centos.md
Created November 10, 2022 11:21
Restart Postgres on Cent OS 7

Restart Postgres on Cent OS 7

  1. Get the service name

    sudo systemctl list-units | grep postgresql
    
  2. Restart the service