Skip to content

Instantly share code, notes, and snippets.

View dumebi's full-sized avatar
🏠
Working from home

Jude Dike dumebi

🏠
Working from home
View GitHub Profile
@dumebi
dumebi / Python-QSTK-Portfolio-Analyzer.py
Created January 13, 2018 18:15
Python-QSTK Portfolio Analyzer
#imports
# QSTK Imports
import QSTK.qstkutil.qsdateutil as du
import QSTK.qstkutil.tsutil as tsu
import QSTK.qstkutil.DataAccess as da
# Third Party Imports
import datetime as dt
import matplotlib.pyplot as plt
import pandas as pd
@dumebi
dumebi / project.ipynb
Created June 21, 2018 16:38
my self driving car issues
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dumebi
dumebi / token.controller.js
Last active January 19, 2020 12:42
Functions for a Token Exchange
const HttpStatus = require('http-status-codes');
const TokenModel = require('../models/token');
const UserModel = require('../models/user');
const UserTokenModel = require('../models/user-token');
const OHLVCModel = require('../models/ohlvc');
const TransactionModel = require('../models/transaction');
const {
paramsNotValid, generateTransactionReference, handleError, handleSuccess
} = require('../utils/utils');
const {
@dumebi
dumebi / Algorithm
Created January 27, 2020 20:52
sample algorithm question
Commander Lambda uses an automated algorithm to assign minions randomly to tasks, in order to keep her minions on their toes. But you've noticed a flaw in the algorithm - it eventually loops back on itself, so that instead of assigning new minions as it iterates, it gets stuck in a cycle of values so that the same minions end up doing the same tasks over and over again. You think proving this to Commander Lambda will help you make a case for your next promotion.
You have worked out that the algorithm has the following process:
1) Start with a random minion ID n, which is a nonnegative integer of length k in base b
2) Define x and y as integers of length k. x has the digits of n in descending order, and y has the digits of n in ascending order
3) Define z = x - y. Add leading zeros to z to maintain length k if necessary
4) Assign n = z to get the next minion ID, and go back to step 2
For example, given minion ID n = 1211, k = 4, b = 10, then x = 2111, y = 1112 and z = 2111 - 1112 = 0999. Then the next m
import Vue from 'vue'
import Router from 'vue-router'
import UserDashboardLayout from '@/layout/User/DashboardLayout'
import CompanyDashboardLayout from '@/layout/Company/DashboardLayout'
import AdminDashboardLayout from '@/layout/Admin/DashboardLayout'
import AuthLayout from '@/layout/AuthLayout'
import LandingPageLayout from '@/layout/LandingLayout'
Vue.use(Router)
import 'vue-loading-overlay/dist/vue-loading.css'
import 'izitoast/dist/css/iziToast.min.css'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
// import './registerServiceWorker'
import store from './store/store'
import DashboardPlugin from './plugins/dashboard'
import utilsMixins from './mixins/utils_mixin'
exports.requiresAuth = (to, from, next, Bacexdata) => {
if (to.matched.some(record => record.meta.requiresUserAuth) && Bacexdata.user.is_auth === false) {
Bacexdata.user.error = 'You need to log in before you can perform this action.'
next({
path:'/login',
query: { redirect: to.fullPath }
})
} else if (to.matched.some(record => record.meta.requiresAdminAuth) && Bacexdata.admin.is_auth === false) {
const { scripts, ConfigManager } = require('@openzeppelin/cli');
const { add, push, create } = scripts;
require('dotenv').config();
async function deploy(options, accounts) {
console.log('accounts ', accounts)
add({ contractsData: [{ name: 'ANO', alias: 'ANO' }] });
await push(options);
await create(Object.assign({ contractAlias: 'ANO', methodName: 'initialize', methodArgs: [
"ANO Token", "ANO", 18, `${process.env.METAMASK_ADDRESS}`, `${process.env.METAMASK_ADDRESS}`, 10
require('dotenv').config();
const { GSNProvider } = require("@openzeppelin/gsn-provider");
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
networks: {
ganache: {
provider() {
return new GSNProvider(`${process.env.GANACHE}`, {useGSN: true})
type User struct {
mogo.DocumentModel `bson:",inline" coll:"users"`
Username string `json:"username" binding:"required"`
Email string `idx:"{email},unique" json:"email" binding:"required"`
Password string `json:"password" binding:"required"`
FirstName string `json:"firstname"`
LastName string `json:"lastname"`
// CreatedAt *time.Time
// UpdatedAt *time.Time
Verified *time.Time `json:"_verified"`