Skip to content

Instantly share code, notes, and snippets.

View isarojdahal's full-sized avatar
:electron:
Learning Everyday

Saroj Dahal isarojdahal

:electron:
Learning Everyday
View GitHub Profile
@isarojdahal
isarojdahal / gist:0ebf3ce61aa143bce638caf97c216a1a
Last active February 8, 2024 10:59
Basic Postgres commands
(JUST IN case : / => frontslash, \ => backslash)
Check postgres version:
psql --version
Connect to postgres:
psql -U postgres
(the postgres user is default superuser for the postgresSQL)
# or the above error showed any socket / Peer Authentication error; then use this;
@bradtraversy
bradtraversy / mern-server-setup.md
Last active June 15, 2024 06:22
Setup Ubuntu & Deploy MERN app

Linux Server Setup & MERN App Deployment

These are the steps to setup an Ubuntu server from scratch and deploy a MERN app with the PM2 process manager and Nginx. We are using Linode, but you could just as well use a different cloud provider or your own machine or VM.

Create an account at Linode

Click on Create Linode

Choose your server options (OS, region, etc)

SSH Keys

/* Program to find probability for rolling of two dies for getting sums of die faces which are either less than or greater than or equal to given number */
const validateData = (input) => {
const result = input.match(/^[<|>|=][1-6]$/);
return result != null ? true : false;
};
const checkProbability = (sign, number) => {
let resultList = [];
let noOfExhaustiveEvent = 0; // this means our favorable event.
@sjosephrw
sjosephrw / mern_nginx_ssl_digitalocean.md
Last active June 7, 2024 04:29
Deploy Multiple MERN apps to a single digital ocean ubuntu droplet with nginx and SSL

Deploy Multiple MERN apps to digital ocean

This tutorial will guide you through the process of deploying multiple MERN apps to a single digital ocean ubuntu VPS droplet Reference

1. Sign up for Digital Ocean

DigitalOcean

2. Create a droplet and Login via SSH

YouTube

@isarojdahal
isarojdahal / a.js
Last active October 21, 2021 16:16
//shows model when document is loaded
$( document ).ready(function() {
setInterval(3000,showModel);
});
function showModel(){
$("#myModel").show();
}
//https://youtu.be/Mgs7jl430vs
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
@fernandoaleman
fernandoaleman / mysql2-catalina.md
Last active July 11, 2023 02:11
Install mysql2 on MacOS Catalina

Problem

Installing mysql2 gem errors on MacOS Catalina with MySQL 5.7.

Solution

Make sure openssl is installed on Mac via Homebrew.

brew install openssl
@zaydek-old
zaydek-old / bookmark.min.js
Last active May 28, 2024 19:18
A *simple* CSS debugger. To use, bookmark "Debug CSS" at https://zaydek.github.io/debug.css. Learn more here https://medium.freecodecamp.org/88529aa5a6a3 and https://youtu.be/2QdzahteCCs?t=1m25s (starts at 1:25)
/* debug.css | MIT License | zaydek.github.com/debug.css */ if (!("is_debugging" in window)) { is_debugging = false; var debug_el = document.createElement("style"); debug_el.append(document.createTextNode(`*:not(g):not(path) { color: hsla(210, 100%, 100%, 0.9) !important; background: hsla(210, 100%, 50%, 0.5) !important; outline: solid 0.25rem hsla(210, 100%, 100%, 0.5) !important; box-shadow: none !important; filter: none !important; }`)); } function enable_debugger() { if (!is_debugging) { document.head.appendChild(debug_el); is_debugging = true; } } function disable_debugger() { if (is_debugging) { document.head.removeChild(debug_el); is_debugging = false; } } !is_debugging ? enable_debugger() : disable_debugger();
@anvaka
anvaka / 00.Intro.md
Last active June 25, 2024 17:06
npm rank

npm rank

This gist is updated daily via cron job and lists stats for npm packages:

  1. Top 1,000 most depended-upon packages
  2. Top 1,000 packages with largest number of dependencies
  3. Top 1,000 packages with highest PageRank score
@gblmarquez
gblmarquez / .tmux.conf
Created August 6, 2015 14:28
.tmux.conf with fish as default shell
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -g default-terminal screen-256color
# support logging out and back in
set -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION"
# pbcopy support
set-option -g default-command "reattach-to-user-namespace -l bash"
# vi mode