Skip to content

Instantly share code, notes, and snippets.

Avatar

Guljar Prasad guljarpd

  • Rivi
  • Bengaluru, India
View GitHub Profile
View AWS-Lambda-Function-For-Cognito.js
/* ----------------------------------- preSignUp -------------------------------------------*/
exports.handler = async (event) => {
// Confirm the user
event.response.autoConfirmUser = true;
// Set the email as verified if it is in the request
if (event.request.userAttributes.hasOwnProperty("email")) {
event.response.autoVerifyEmail = true;
@guljarpd
guljarpd / migrate-redis-db.sh
Created Aug 21, 2019
migrate redis db to another redis db.
View migrate-redis-db.sh
#!/bin/bash
#source DB (localhost or IP)
source_host=localhost
source_port=6379
source_db=0
#target DB (localhost or IP)
target_host=localhost2
target_port=6379
target_db=0
@guljarpd
guljarpd / Guardian JWT.md
Created Jan 18, 2019 — forked from nikneroz/Guardian JWT.md
Elixir + Phoenix Framework + Guardian + JWT. This is tutorial and step by step installation guide.
View Guardian JWT.md

Elixir + Phoenix Framework + Guardian + JWT + Comeonin

Preparing environment

We need to generate secret key for development environment.

mix phoenix.gen.secret
# ednkXywWll1d2svDEpbA39R5kfkc9l96j0+u7A8MgKM+pbwbeDsuYB8MP2WUW1hf

Let's generate User model and controller.

@guljarpd
guljarpd / mentions.js
Created Dec 1, 2018 — forked from nicubarbaros/mentions.js
Draft Js Mentions
View mentions.js
import { convertFromRaw, convertToRaw, ContentState } from 'draft-js';
const getIndicesOf = (searchStr, str, caseSensitive) => {
let tempStr = str;
let tempSearchStr = searchStr;
const searchStrLen = tempSearchStr.length;
if (searchStrLen === 0) {
return [];
}
let startIndex = 0;
@guljarpd
guljarpd / Commands.sh
Created May 2, 2018 — forked from nrollr/Commands.sh
Install PHP and NGINX on Amazon Linux AMI
View Commands.sh
## Install NGINX
$ sudo yum install nginx -y
## Install PHP and PHP-FPM
$ sudo yum install php -y
$ sudo yum install php-fpm -y
## Configure NGINX (see below)
$ sudo nano /etc/nginx/conf.d/default.conf
You can’t perform that action at this time.