Skip to content

Instantly share code, notes, and snippets.

View kayslay's full-sized avatar
🎯
Focusing

Badewa Kayode kayslay

🎯
Focusing
View GitHub Profile
@kayslay
kayslay / multiples.js
Last active September 20, 2017 22:47
Calculates the sum of all multiples of numbers in an array between a limit
/**
* @description removes the multiples in the array
* @param arr
* @returns {Number}
*/
function notMultiples(arr) {
arr = arr.sort((a, b) => a - b);
return arr.reduce((notMul, num) => {
if (notMul.length) {
if ((notMul.some(div => (num % div === 0)))) {
@kayslay
kayslay / db.js
Created September 20, 2017 21:36
db.js file for Build a CLI to crawl a web page with web-crawljs article.
/**
* Created by kayslay on 6/3/17.
*/
module.exports = {
dbName: "crawl",
dbHost: "localhost",
};
@kayslay
kayslay / wiki.js
Last active September 21, 2017 07:26
wiki.js for Build a CLI to crawl a web page with web-crawljs article
/**
* Created by kayslay on 6/3/17.
*/
const mongoose = require('mongoose');
const dbConfig = require('../config/db');
//mongoose configs
const Schema = mongoose.Schema;
//creating a schema for the extracted data
const wikiSchema = new Schema({
title: String,
@kayslay
kayslay / crawl.js
Last active August 15, 2018 12:44
crawl.js for Build a CLI to crawl a web page with web-crawljs article
#!/usr/bin/env node
/**
* Created by kayslay on 5/31/17.
*/
const crawler = require('web-crawljs');
const program = require('commander');
//commander configuration
function list(val) {
"use strict";
@kayslay
kayslay / MergeSort.go
Created September 29, 2017 16:19
merge sort using Golang
package main
import (
"fmt"
)
var (
list []int = []int{838, 23, 83, 64, 83, 23, 63, 90, 50, 20, 20, 4, 30, 5, 2, 50, 190, 19, 3, 70, 21, 3, 20, 28, 93, 39, 838, 23, 83, 64, 83, 23, 63, 90, 50, 20}
)
@kayslay
kayslay / Xvfb-restart-script.sh
Created March 13, 2018 04:45 — forked from Nimrod007/Xvfb-restart-script.sh
Xvfb restart script
echo "restart Xvfb"
kill -9 `ps aux | grep Xvfb | grep -v grep | awk '{print $2}'`
sleep 3
nohup Xvfb :10 -ac > /tmp/Xvfb.log 2>&1 &
echo "Xvfb started"
exit
@kayslay
kayslay / busha-pay-socket.md
Last active July 22, 2019 16:18
Busha Pays socket connection

BushaPay socket connection

Once a charge has been created, it status can be monitored by connecting the websocket client to https://api.pay.busha.co/charges/{chargeID}/status.

Replace chargeID in the route with id of created/existing charge.

The socket sends a Chargeon every update. whenever an event (payment,expire .e.t.c) occurs on the full charge object with the updates. check charge resource for more details.

package main
import (
"io"
"sync"
"time"
)
// a function that does much cpu bound work
func fibo(n int) int {
package main
import (
"runtime"
"testing"
)
// limit to a single processor
var _ = runtime.GOMAXPROCS(1)