Skip to content

Instantly share code, notes, and snippets.

Avatar

przbadu przbadu

View GitHub Profile
@przbadu
przbadu / ActiveRecord::StatementInvalid: PG::NotNullViolation: ERROR: null value in column "id" violates not-null constraint .sql
Last active Dec 30, 2020
ActiveRecord::StatementInvalid: PG::NotNullViolation: ERROR: null value in column "id" violates not-null constraint
View ActiveRecord::StatementInvalid: PG::NotNullViolation: ERROR: null value in column "id" violates not-null constraint .sql
-- Login to psql and run the following
-- What is the result?
SELECT MAX(id) FROM your_table;
-- Then run...
-- If your_table_id_seq is missing, then first create it
CREATE SEQUENCE tablename_colname_seq;
-- This should be higher than the last result.
SELECT nextval('your_table_id_seq');
@przbadu
przbadu / react_on_docker2.md
Created Oct 29, 2020
Docker configuration to run react app
View react_on_docker2.md

Setup docker to run React app

After setting up docker to generate React app without installing node js in https://gist.github.com/przbadu/4a62a5fc5f117cda1ed5dc5409bd4ac1 It was confusing to some of the devs, how to run react app, so I am creating this as second step to the configuration.

Generate required files in your react project

cd my-react-app
touch Dockerfile Dockerfile.dev docker-compose.yml .dockerignore
@przbadu
przbadu / change_audio_source.md
Created Oct 21, 2020
Change audio output source in linux
View change_audio_source.md

Get the audio sources

To get complete response

pacmd list-sinks

To get short response

@przbadu
przbadu / script.md
Created Aug 31, 2020
Fix libssl error for old rubies
View script.md

pruge latest libssl and install libssl1.0-dev

sudo apt purge libssl-dev && sudo apt install libssl1.0-dev

Install ruby with rbenv (recommended)

rbenv install 2.3.1
@przbadu
przbadu / brightness-script.md
Created Aug 22, 2020
How to control monitor brightness from linux PC using terminal
View brightness-script.md

Open terminal app

Press Ctrl + Alt + T or search for terminal application and open it.

Get Monitor's Device Name

First get monitor's device name using below terminal command:

xrandr | grep " connected" | cut -f1 -d " "
@przbadu
przbadu / docker-postgres.md
Last active Jul 29, 2019
docker-postgresql-setup
View docker-postgres.md

Create docker-compose.yml file

version: "3"
services:
  db:
    image: "postgres"
    container_name: "my_postgres"
    ports:
      - "54320:5432"
@przbadu
przbadu / heroku-copy-config
Created Apr 24, 2018
copy heroku config vars from source app to target app.
View heroku-copy-config
#!/bin/bash
# Author: przbadu
#
# Usage: heroku-copy-config <source> <target>
set -e
sourceApp="$1"
targetApp="$2"
config=""
@przbadu
przbadu / Windows rails deployment.md
Last active Sep 19, 2020 — forked from userrails/Windows rails deployment.md
Deployment steps for rails in windows
View Windows rails deployment.md
@przbadu
przbadu / notes.md
Created Oct 26, 2017 — forked from matthewjberger/notes.md
How to make an electron app using Create-React-App and Electron with Electron-Builder.
View notes.md