Skip to content

Instantly share code, notes, and snippets.

View duartefdias's full-sized avatar

Duarte Dias duartefdias

View GitHub Profile
const JwtStrategy = require('passport-jwt').Strategy;
const ExtractJwt = require('passport-jwt').ExtractJwt;
const mongoose = require('mongoose');
import User from '../models/users';
const opts = {};
opts.jwtFromRequest = ExtractJwt.fromAuthHeaderAsBearerToken();
opts.secretOrKey = process.env.JWT_SECRET;
module.exports = passport => {
var express = require('express');
var router = express.Router();
// Used to perfrom signature authentication
var ethUtil = require('ethereumjs-util');
// JWT generation and verification
const jwt = require('jsonwebtoken');
import passport from 'passport'
<script>
import Web3 from 'web3'
export default ({
data() {
return {
buttonDisabled: false,
buttonInstallText: "Click here to install Metamask",
}
},
@duartefdias
duartefdias / gist:9b1c917b9cc101b6dff6542868687876
Created December 30, 2020 15:04
Create VM in Azure powershell script
# Login to Azure using Service Principal credentials from Github Secrets
Write-Output "Logging in to Azure with a service principal..."
az login `
--service-principal `
--username $Env:SP_CLIENT_ID `
--password $Env:SP_CLIENT_SECRET `
--tenant $Env:SP_TENANT_ID
Write-Output "Done"
# Select Azure subscription
@duartefdias
duartefdias / create-vm.yml
Last active December 30, 2020 16:10
Call powershell script with Azure data
on: [workflow_dispatch]
name: DeployAzureVM
jobs:
CreateAzureVM:
runs-on: windows-latest
steps:
# # C1: Each room can only hold 1 class at a time
def check_C1(self, A, a, B, b):
if a[0] == b[0] and a[1] == b[1] and a[2] == b[2]:
return False
return True
# # C2: Each student (class) can only attend a class at a time
def check_C2(self, A, a, B, b):
for key in dict1: