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
#!/usr/bin/env bash | |
set -euo pipefail | |
# Variables | |
IMAGE_NAME="my_image_name" | |
CONTAINER_NAME="my_container_name" | |
TAG="latest" | |
# Build Docker image |
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
const {STSClient, AssumeRoleCommand} = require("@aws-sdk/client-sts"); | |
const {QuickSightClient, GetDashboardEmbedUrlCommand, RegisterUserCommand} = require("@aws-sdk/client-quicksight"); | |
const AWS_REGION = "us-east-1"; | |
const AWS_ACCOUNT_ID = "123456789012"; | |
const QUICKSIGHT_ROLE_ARN = `arn:aws:iam::${AWS_ACCOUNT_ID}:role/QuicksightDashboardViewer`; | |
const stsClient = new STSClient({ | |
region: AWS_REGION | |
}); |
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
const getEmbedUrl = async (qsClient, dashboardId) => { | |
console.log(`Fetching embed url`); | |
const param = { | |
AwsAccountId: AWS_ACCOUNT_ID, | |
DashboardId: dashboardId, | |
IdentityType: "IAM", | |
UndoRedoDisabled: true, | |
ResetDisabled: true | |
}; |
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
const registerUser = async (qsClient, email) => { | |
console.log(`Registering user`); | |
const param = { | |
IdentityType: "IAM", | |
Email: email, | |
UserRole: "READER", | |
IamArn: QUICKSIGHT_ROLE_ARN, | |
SessionName: email, | |
AwsAccountId: AWS_ACCOUNT_ID, | |
Namespace: "default" |
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
const assumeRole = async (email) => { | |
console.log(`Assuming role`); | |
const param = { | |
RoleArn: QUICKSIGHT_ROLE_ARN, | |
RoleSessionName: email, // An unique identifier like email/username etc | |
DurationSeconds: 900, | |
}; | |
const command = new AssumeRoleCommand(param); | |
const response = await stsClient.send(command); |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Action": "quicksight:RegisterUser", | |
"Resource": "*", | |
"Effect": "Allow" | |
}, | |
{ | |
"Action": "quicksight:GetDashboardEmbedUrl", |
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
import React, { useState } from 'react'; | |
import AutoSuggestInput from 'autosuggest-input-box'; | |
import { Box, Control, Label, Row } from './AutoSuggestInputStyle'; | |
const countries = [ | |
'China', | |
'India', | |
'United States', | |
'Indonesia', | |
'Pakistan', |
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
import React, { useState } from 'react'; | |
import { Editor, EditorState, RichUtils } from 'draft-js'; | |
import { | |
FaBold, | |
FaCode, | |
FaHeading, | |
FaItalic, | |
FaListOl, | |
FaListUl, |
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
class ZapOne { | |
synchronized void print(int n) { | |
for (int i = 1; i <= 5; i++) { | |
System.out.println(n * i); | |
} | |
} | |
} | |
//Synchronized Function | |
class coding extends Thread { |
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
public static void showProgressBar(int length, int interval, String message) { | |
char incomplete = '░'; | |
char complete = '█'; | |
StringBuilder progress = new StringBuilder(); | |
// Initialize | |
Stream.generate(() -> incomplete).limit(length).forEach(progress::append); | |
StringBuilder percent = new StringBuilder("0"); | |
String format = "\r[%s] %s%%"; |
NewerOlder