Skip to content

Instantly share code, notes, and snippets.

@erdarafika
erdarafika / fix-of-redis-error.md
Created June 16, 2020 15:19 — forked from hivokas/fix-of-redis-error.md
Fix of Redis error (Can't save in background: fork: Cannot allocate memory)

Errors from Laravel logs:

MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.

ERR Error running script (call to f_1af8e79ebe56ad4d7910f2e116e2555983099baf): @user_script:8: @user_script: 8: -MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.

Errors from Redis logs (/var/log/redis/redis-server.log):

* 1 changes in 900 seconds. Saving...
@erdarafika
erdarafika / postgres_array.go
Created May 16, 2020 01:32 — forked from adharris/postgres_array.go
PostgreSQL demo of Array types using Golang
package main
import (
"database/sql"
"errors"
"fmt"
_ "github.com/bmizerany/pq"
"os"
"regexp"
"strings"
@erdarafika
erdarafika / mysql-docker.sh
Created September 3, 2019 03:35 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
const express = require('express')
const requestIp = require('request-ip')
const useragent = require('express-useragent')
const mongoose = require('mongoose')
const Promise = require('bluebird')
const cors = require('cors')
const helmet = require('helmet')
const bodyParser = require('body-parser')
const app = express()
const router = require('./router')
@erdarafika
erdarafika / docker-build.sh
Created April 22, 2019 07:47 — forked from moinsam/docker-build.sh
Bash Script to build and push Docker image into ECR
#!/bin/bash
if [ $# -eq 0 ]; then
echo "No arguments provided"
exit 1
fi
if [[ -z $2 ]]; then
echo ---------------Node-----------------