Skip to content

Instantly share code, notes, and snippets.

View joshatxantie's full-sized avatar

Josh Smith joshatxantie

  • Xantie
  • SLC, Utah
View GitHub Profile
@joshatxantie
joshatxantie / EmbedComponent.tsx
Created June 7, 2023 22:23
React PowerBI Embed Component
// Required Packages:
// npm install --save powerbi-client powerbi-client-react
import React, {useEffect, useState} from 'react'
import { PowerBIEmbed } from 'powerbi-client-react';
import { models } from "powerbi-client";
declare const BackendAPI: any;
type EmbedConfigResponse = {
@joshatxantie
joshatxantie / embed.route.js
Last active June 7, 2023 22:24
PowerBI Node.js Express Controller
const PowerBiService = require("../path/to/powerbi.service.js");
module.exports.getEmbedInfo = async (req, res) => {
// Get the details like Embed URL, Access token and Expiry
try {
let result = await PowerBiService.getEmbedInfo(
"", // Workspace Id
[""] // Report Id
);
res.status(result.status).send(result);
@joshatxantie
joshatxantie / powerbi.service.js
Created June 7, 2023 22:18
PowerBI Microsoft Service (Backend)
// ----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// ----------------------------------------------------------------------------
const fetch = require("node-fetch");
let adal = require("adal-node");
const {
REACT_APP_TENANT_ID,
AZURE_APP_CLIENT_ID,
@joshatxantie
joshatxantie / template.html
Last active June 16, 2022 21:12
Handlebars Email template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sample</title>
</head>
<body>
<h1>Sample email with variable injection, utilizing handlebars library</h1>
@joshatxantie
joshatxantie / email.js
Last active June 16, 2022 21:11
Send email via Google, Nodemailer
require('dotenv').config();
const fs = require('fs'),
path = require('path'),
Handlebars = require('handlebars'),
nodemailer = require('nodemailer'),
{ google } = require('googleapis'),
OAuth2 = google.auth.OAuth2,
{
GMAIL_REFRESH_TOKEN,
GMAIL_CLIENT_SECRET,
@joshatxantie
joshatxantie / Dockerfile
Created April 13, 2022 22:13
Python 3.8 AWS Lambda PostgreSQL
FROM public.ecr.aws/lambda/python:3.8
COPY . ${LAMBDA_TASK_ROOT}
RUN yum install -y gcc python27 python27-devel postgresql-devel
RUN pip3 install -r requirements.txt --target "${LAMBDA_TASK_ROOT}"
CMD [ "app.handler" ]
@joshatxantie
joshatxantie / Dockerfile
Created December 1, 2021 14:25
AWS Lambda Container Image for Python and PYODBC
FROM public.ecr.aws/lambda/python:3.9
COPY . ${LAMBDA_TASK_ROOT}
RUN yum update -y \
&& curl https://packages.microsoft.com/config/rhel/8/prod.repo > /etc/yum.repos.d/mssql-release.repo \
&& yum remove unixODBC-utf16 unixODBC-utf16-devel \
&& ACCEPT_EULA=Y yum install -y msodbcsql17 \
&& ACCEPT_EULA=Y yum install -y mssql-tools \
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc \
@joshatxantie
joshatxantie / gist:4bcf5d0243fba63845fce7cc40365a3a
Created September 2, 2021 04:18
Dockerize Pyodbc/SQL Server
# syntax=docker/dockerfile:1
FROM python:3.8-slim-buster
WORKDIR /app
ENV ACCEPT_EULA=Y
RUN apt-get update -y && apt-get update \
&& apt-get install -y --no-install-recommends curl gcc g++ gnupg unixodbc-dev