Skip to content

Instantly share code, notes, and snippets.

View devansvd's full-sized avatar
🤗
Available

Devan devansvd

🤗
Available
View GitHub Profile
@devansvd
devansvd / console.js
Created December 23, 2019 19:46 — forked from Harshmakadia/console.js
Mastering JS console like a Pro
// time and time end
console.time("This");
let total = 0;
for (let j = 0; j < 10000; j++) {
total += j
}
console.log("Result", total);
console.timeEnd("This");
// Memory
# https://medium.com/happy-cog/deploying-static-websites-to-aws-s3-behind-an-nginx-proxy-fd51cc0c53ec
# redirect devan.example.com to devan.s3.amazonaws.com
server {
listen 80;
listen 443 ssl;
server_name ~^(.*)\.example\.com$;
ssl_certificate /etc/nginx/certs/fullchain.pem;
@devansvd
devansvd / keycloak-token.md
Last active October 14, 2019 16:39
Ways to retrive token from keycloak

Master Realm Level Access:

curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d "username=xxxxx" \
 -d 'password=xxxxx' \
 -d 'grant_type=password' \
 -d 'client_id=admin-cli'
@devansvd
devansvd / .bash_profile
Last active July 26, 2019 13:12
My bashrc
# Get the Git branch
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# Custom bash prompt
#
# Includes custom character for the prompt, path, and Git branch name.
#
# Source: kirsle.net/wizards/ps1.html and https://github.com/mdo/config
@devansvd
devansvd / tmux.conf
Created June 12, 2019 13:34 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
ElasticSearch Cheat sheet
Create an Index via SENSE
PUT /movies
{
"settings" : {
"number_of_shards" : 5,
"number_of_replicas" : 1
abstract class AuthService {
// Subject tracks the current token, or is null if no token is currently
// available (e.g. refresh pending).
private subject = new BehaviorSubject<string|null>(null);
readonly refreshToken: Observable<any>;
readonly token: Observable<string>;
constructor() {
// refreshToken, when subscribed, gets the new token from the backend,
@devansvd
devansvd / redis_cheatsheet.bash
Created December 13, 2018 07:28 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
//Angular 2 above application static server
const http = require('http');
const express = require('express');
const proxy = require('http-proxy-middleware');
const path = require('path');
const app = express();
app.use(express.static('client'));
@devansvd
devansvd / README.md
Created October 8, 2018 10:10 — forked from pbojinov/README.md
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.

Parent

Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')

iframe