Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am kbrsh on github.
  • I am kbrsh (https://keybase.io/kbrsh) on keybase.
  • I have a public key ASCH4EtLMIQskNSeqTlq8KR7V97M12QLBJG61Qn3i-_LAQo

To claim this, I am signing this object:

@kbrsh
kbrsh / galaxy.py
Last active Sep 1, 2017
Galaxy - Spread Stars
View galaxy.py
from slackclient import SlackClient
from random import randint
import re
import time
import sqlite3
import os
userRE = re.compile("<@([\w\d]+)>")
db = sqlite3.connect("Galaxy.db")
@kbrsh
kbrsh / bars.js
Last active Jun 29, 2017
Bars - Bar graph component for Moon
View bars.js
(function(root, factory) {
/* ======= Global Moon Bars ======= */
(typeof module === "object" && module.exports) ? module.exports = factory() : root.MoonBars = factory();
}(this, function() {
var pad = function(section) {
if(section.length === 1) {
return "0" + section;
} else {
return section;
@kbrsh
kbrsh / README.md
Last active Oct 27, 2017
Slash - Fast, efficient hash
View README.md

Slash

Fast, efficient hash

Usage

char *str = "Slash";
unsigned long long hash = slash(str);
@kbrsh
kbrsh / kms.js
Last active May 21, 2017
Search Algorithms
View kms.js
const createTable = function(item, length) {
let table = new Array(length);
table[0] = 0;
for(let i = 1; i < length; i++) {
var section = item.substring(0, i + 1);
var sectionLength = section.length;
var val = 0;
for(let j = sectionLength - 1; j > 0; j--) {
@kbrsh
kbrsh / key.js
Last active Nov 30, 2016
Key - generate a random token
View key.js
var crypto = require('crypto');
var apiKey = function(cb) {
crypto.randomBytes(7, function (err, bytes) {
key = new Buffer((new Date().valueOf()) + (bytes).toString('hex')).toString('base64');
cb(key);
});
}