Skip to content

Instantly share code, notes, and snippets.

View bmatusiak's full-sized avatar
👌
Having Fun

Bradley Matusiak bmatusiak

👌
Having Fun
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);
});
});
};
module.exports = function(pwd, extra) {
var forge = require("node-forge");
forge.options.usePureJavaScript = true;
var EC = require('elliptic').ec;
return new Promise((resolve, reject) => {
var ec_p256 = new EC('p256');
if (!pwd)
@pathnirvana
pathnirvana / AsyncJava.js
Last active January 31, 2024 18:15
Async Await call to JavascriptInterface Android Java WebView
// Allows to call a Android java function asynchronously
// spawn long running computations/io on the Java/Android without blocking the JS/Website running inside the WebView
// Eg. const result = await callAndroidAsync('javaFunction', { param1: 'value1', param2: 'value2' })
// Please give a star if you find this useful
export async function callAndroidAsync(javaFuncName, params) {
const rand = 'asyncJava_' + Math.floor(Math.random() * 1000000)
window[rand] = {}
// func called from android
var bitHex = 8;
//idea is that when a pub key gets created, the user stores this int32 in its profile.
//then when you go to fetch the list of pubkeys, hash the key and also fetch the int32 from the profile
//compair the alias + int32 and show the user profile(s) to the requesting user for decision
//when user has decided save the pubkey and any other meta data you wish
var sha256_toint_test = "something like a publickey that has a reference of the output int32";
# wget -qO- https://goo.gl/HBY9jh | sh
wget http://www.webmin.com/download/deb/webmin-current.deb -O webmin.deb
sudo apt-get update
sudo apt-get install perl libnet-ssleay-perl libauthen-pam-perl libio-pty-perl apt-show-versions -y
sudo dpkg -i webmin.deb
sudo apt-get -f install -y
rm -rf webmin.deb
.clearfix {
*zoom: 1;
}
.clearfix:before,
.clearfix:after {
display: table;
line-height: 0;
content: "";
}
@bmatusiak
bmatusiak / 0 - top .md
Last active December 15, 2015 16:59
cloud9 Image Processing
@bmatusiak
bmatusiak / app.js
Created November 14, 2012 03:38
express/mongodb socket.io/redis AIO
/**
* Session Storage for multi servers ex.Heroku stacks
* for expressjs socket.io with databases redis and mongodb
* (redis/socket.io)
* (mongodb/expressjs)
*
* Bradley Matusiak @ 2012 bmatusiak@gmail.com
*
* ref:bunch of searches from google
**/
@bmatusiak
bmatusiak / Output
Created October 25, 2012 18:49
My Class Concept
SlaveClass 1constructor lol
SlaveClass 2constructor lol
SlaveClass 3constructor lol
SlaveClass v1.3
SlaveClass a
SlaveClass b
SlaveClass c
{}