Skip to content

Instantly share code, notes, and snippets.

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

Pushpa Raj Badu przbadu

🏠
Working from home
View GitHub Profile
@przbadu
przbadu / change_audio_source.md
Created October 21, 2020 05:45
Change audio output source in linux

Get the audio sources

To get complete response

pacmd list-sinks

To get short response

@przbadu
przbadu / realmExample.js
Created September 23, 2021 07:59
Example of Realm association
const Realm = require("realm");
const Post = {
name: "Post",
properties: {
timestamp: 'date',
content: 'string',
title: "string",
comments: 'Comment[]'
},
};
@przbadu
przbadu / tmux.conf
Last active August 17, 2021 05:36
tmux conf file [przbadu]
###########################
# Configuration
###########################
# use 256 term for pretty colors
# set -g default-terminal "screen-256color" # making tmux slow
set -g default-terminal "xterm-256color"
# Enable mouse support
set -g mouse on
@przbadu
przbadu / ActiveRecord::StatementInvalid: PG::NotNullViolation: ERROR: null value in column "id" violates not-null constraint .sql
Last active May 5, 2021 07:31
ActiveRecord::StatementInvalid: PG::NotNullViolation: ERROR: null value in column "id" violates not-null constraint
-- 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.

pull postgres image

docker pull postgres:latest

Run docker container

NOTE: If your local postgres installation is running in port 5432, then bind different port with 5433:5432

@przbadu
przbadu / script.md
Created August 31, 2020 06:09
Fix libssl error for old rubies

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 August 22, 2020 02:17
How to control monitor brightness from linux PC using terminal

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 / Setup-ubuntu-for-web-development.sh
Last active July 26, 2020 20:42
Setting up ubuntu for web development for first time
#!/bin/sh
# Author: przbadu
# email: przbadu.social@gmail.com
# github: github.com/przbadu
# update ubuntu
sudo apt-get update
# install vim, git, curl, tmux
sudo apt-get install vim git curl tmux
# install the silver searcher
@przbadu
przbadu / php development environment ubuntu 16.04.md
Last active May 7, 2018 21:03
PHP, mysql, apache2 setup for ubuntu 16.04

Install required packages including PHP 7 and 5.6, apache2 and mysql

# Install git
sudo apt-get install git vim

# Add ondrej/php ppa
sudo apt-add-repository -y ppa:ondrej/php

# update package