Skip to content

Instantly share code, notes, and snippets.

View devansvd's full-sized avatar
🤗
Available

Devan devansvd

🤗
Available
View GitHub Profile
@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.
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,
ElasticSearch Cheat sheet
Create an Index via SENSE
PUT /movies
{
"settings" : {
"number_of_shards" : 5,
"number_of_replicas" : 1
@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
@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 / 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'
# 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 / 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
@devansvd
devansvd / Vscode-Formatter-setup.md
Last active June 9, 2020 12:19
My standard prettier formatter configuration

Auto format staged files before commit, Prettier is the best formatter available now, but it formats html ugly. Using beautify to formatter only html, others prettier will handle

Note: use common print width 100 for both beautify and prettier

Install devDependencies

npm i -D husky prettier js-beautify lint-staged
{"lastUpload":"2020-06-09T12:06:09.644Z","extensionVersion":"v3.4.3"}