Skip to content

Instantly share code, notes, and snippets.

View draeder's full-sized avatar
🔑
Diffie-Hellman

Daniel Raeder draeder

🔑
Diffie-Hellman
View GitHub Profile
@draeder
draeder / totp.js
Created October 22, 2023 21:20
TOTP in javascript
// Example useage at the bottom
async function generateTOTP(username, secret, issuer, rotation, digits) {
let totp = () => {
return new Promise((resolve) => {
let counter = TOTP.getCurrentCounter(rotation);
TOTP.otp(secret, counter, digits, (cb) => {
resolve(cb);
});
});
};
@draeder
draeder / TodoPage.vue
Last active January 26, 2023 21:34
TodoPage.vue for Quasar 2.11.5
<!--
Adapted from Rebecca Manzi's [Todo App](https://github.com/rebeccamanzi/quasar-todo) for Quasar 1.0.0. This one works
correctly with Quasar 2.11.5. To use it, update quasar.config.js > frameworks > plugins to include 'Notify' in the plugins
array.
-->
<template>
<q-page class="bg-grey-3 column">
<div class="row q-pa-sm bg-primary">
<q-input
@draeder
draeder / server.js
Created May 30, 2022 14:35
Gun server example
const http = require('http')
const Gun = require('gun')
// Uncomment for ES6, and remove requires above
// import http from 'http'
// import Gun from 'gun'
const server = http.createServer()
const host = 'localhost'
@draeder
draeder / 1243.js
Last active May 31, 2022 01:39
Gun Heroku one-click deploy testing
/**
* NOTE: Does not work with npm installed heroku-cli
* Uninstall with: npm uninstall heroku -g
* Install Heroku with: curl https://cli-assets.heroku.com/install.sh | sh
*/
const { exec } = require('node:child_process')
const expect = require('../expect')
describe('Heroku deploy', function(){
it('Returns an error if heroku CREATE fails', async function(){