Skip to content

Instantly share code, notes, and snippets.

View mariotacke's full-sized avatar
💻
Specializing in the outrageous.

Mario Tacke mariotacke

💻
Specializing in the outrageous.
View GitHub Profile
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

Keybase proof

I hereby claim:

  • I am mariotacke on github.
  • I am mariotacke (https://keybase.io/mariotacke) on keybase.
  • I have a public key whose fingerprint is 1F76 387C 0FA4 7B32 B93E 8211 24A9 1971 A631 92F4

To claim this, I am signing this object:

@mariotacke
mariotacke / init.coffee
Last active May 15, 2018 19:52
Atom Sync Settings
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@mariotacke
mariotacke / .eslintrc
Last active May 29, 2018 16:47
ESLint Configs
{
"env": {
"node": true,
"es6": true
},
"extends": [
"eslint:recommended"
],
"parserOptions": {
"sourceType": "module",
@mariotacke
mariotacke / rabbitmq-password.sh
Created December 18, 2018 21:26
Computing RabbitMQ Password Hashes
# https://www.rabbitmq.com/passwords.html#computing-password-hash
PASSWORD=$(openssl rand -base64 20)
SALT=$(openssl rand -hex 4)
HASH=$(echo -n "$SALT"$(echo -n "$PASSWORD" | xxd -u -p) | xxd -r -p | sha256sum | head -c 64)
PASSWORD_HASH=$(echo -n $SALT$HASH | xxd -r -p | base64)
echo $PASSWORD
echo $PASSWORD_HASH
@mariotacke
mariotacke / server.js
Created May 19, 2019 21:53
blog-real-time-word-cloud
const express = require('express');
const path = require('path');
const fs = require('fs');
const indexHtml = fs.readFileSync(path.join(__dirname, 'public', 'index.html'), 'utf8');
const app = express();
app.get('/', function (req, res) {
const html = indexHtml.replace(/\$CHANNEL_NAME/, process.env.CHANNEL_NAME);
@mariotacke
mariotacke / server.js
Created May 19, 2019 22:04
blog-real-time-word-cloud
const tmi = require('tmi.js');
const redis = require('redis');
const bluebird = require('bluebird');
bluebird.promisifyAll(redis);
const options = {
identity: {
username: process.env.BOT_USERNAME,
password: process.env.OAUTH_TOKEN,
@mariotacke
mariotacke / server.js
Last active May 20, 2019 01:03
blog-real-time-word-cloud
app.get('/api/channel/:channel/words', async function (req, res) {
const channel = `#${req.params.channel}`;
const args = [channel, '0', '50', 'WITHSCORES'];
const scores = [];
const range = await redisClient.zrevrangeAsync(args);
for (let i = 0; i < range.length; i += 2) {
scores.push({
key: range[i],
@mariotacke
mariotacke / index.js
Last active May 20, 2019 01:08
blog-real-time-word-cloud
async function getCloud () {
const response = await fetch('/api/channel/$CHANNEL_NAME/words');
const json = await response.json();
const cloud = json.scores.map(function ({ key, value }) {
return { text: key, size: value };
});
return cloud;
}
@mariotacke
mariotacke / index.js
Last active May 20, 2019 02:01
blog-real-time-word-cloud
async function init () {
const cloud = await getCloud();
const highestScore = Math.max(...cloud.map((x) => x.size));
var layout = d3.layout.cloud()
.size([500, 500])
.words(cloud)
.rotate(function () { return ~~(Math.random() * 2) * 90; })
.font("Impact")