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'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ElasticSearch Cheat sheet | |
Create an Index via SENSE | |
PUT /movies | |
{ | |
"settings" : { | |
"number_of_shards" : 5, | |
"number_of_replicas" : 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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')); |