Skip to content

Instantly share code, notes, and snippets.

View knbknb's full-sized avatar
💭
🙅‍♀️💡💤😴🛌🤪🧔

Knut Behrends knbknb

💭
🙅‍♀️💡💤😴🛌🤪🧔
View GitHub Profile
@knbknb
knbknb / rvirtual_currencies.sh
Last active May 25, 2022 12:29
rvirtual_currencies.sh - bash script to generate a plot of current EUR-Price, of cryptocurrencies, using R
#!/usr/bin/env bash
# generate SVG plot of recent activity for top 10 cryptocurrencies
# knb 2022
# Script needs curl, jq, R (tidyverse), awk, imagemagick, firefox
# and "Rio" -> https://github.com/jeroenjanssens/data-science-at-the-command-line/blob/master/tools/Rio
#infile=cryptocur_top10.json
infile=$(mktemp /tmp/cryptocurr-$(date +"%Y-%m-%d_%T_XXXXXX"))
COINMARKETCAP_API_KEY=$([ -f ~/.env ] && cat ~/.env | grep COINMARKETCAP_API_KEY | cut -d '=' -f2)
export GDK_SCALE=3
@knbknb
knbknb / virtual_currencies.sh
Last active May 25, 2022 12:31
virtual_currencies.sh - bash script to get financial metrics of 10 most popular cryptocurrencies
#!/bin/sh
# https://stackoverflow.com/questions/48100901/convert-a-string-to-a-number-using-jq
#infile=cryptocur_top10.json
infile=$(mktemp /tmp/cryptocurr-$(date +"%Y-%m-%d_%T_XXXXXX")).json
export COINMARKETCAP_API_KEY=$([ -f ~/.env ] && cat ~/.env | grep COINMARKETCAP_API_KEY | cut -d '=' -f2)
# get current top-10 data from coinmarketcap
curl -sLo "$infile" \
-H "X-CMC_PRO_API_KEY: $COINMARKETCAP_API_KEY" \
@knbknb
knbknb / .eslintrc.json
Created October 5, 2018 20:29 — forked from coryhouse/.eslintrc.json
.eslintrc.json file for "Building a JavaScript Development" Pluralsight course
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings"
],
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module"
@knbknb
knbknb / nct6791.conf
Last active December 10, 2019 08:36
Config file for customizing output of linux `sensors` command, for my PC mainboard. See my gist-comment below on how to use this.
# Configuration file for ASUS H87-PRO
# 2014-01-21/mg
chip "nct6791-*"
label in0 "Vcore"
# compute in0 @*2 , @/2
set in0_min 0.75
set in0_max 1.35
@knbknb
knbknb / noder.sh
Last active December 6, 2018 12:57
start node repl with favorite options and modules
#!/bin/bash
# noder.sh : my node repl
# load nodejs repl with lodash preloaded
# - only for nvm users,
# - and lodash must be installed globally
# - optional: rlwrap utility installed with e.g. apt install rlwrap
# (if it is not installed remove rlwrap in NODE_PATH line below)
# knb 20181013
node_version=$(node -p process.versions.node);
extra_path="$HOME/.nvm/versions/node/v$node_version/lib/node_modules/";
@knbknb
knbknb / node-client-server-todolist-mini-cli-app.md
Last active November 18, 2018 10:11
a TODO-list CLI app implemented using only builtin node modules (EventEmitter, process, readline)

Run the app on the command line with: node client.js. This implicitly loads server.js.

From Samir Buna's "Advanced NodeJS" course on Pluralsight

client.js

const EventEmitter = require('events');
const readline = require('readline');

const rl = readline.createInterface({
@knbknb
knbknb / pluralsight-es6-the-right-parts.txt
Last active December 14, 2018 14:19
ES6: The Right Parts (personal Notes taken watching a video feat. JS guru Kyle Simpson)
ex0: The arrow function: (x) => 3;
ex1: var vs let
ex2: Default-values, and gather/spread
ex3: Destructuring
ex4: Concise properties and methods, Template Strings, Tag functions
@knbknb
knbknb / node-npm-notes.md
Last active April 21, 2024 20:07
node and npm - Personal notes, 2018

Personal Notes on some Nodejs related courses, npm, and Modern Javascript

"Node.js: Getting Started"; "Advanced Node.js" by Samer Buna;

"NPM Playbook" by Joe Eames;

and other courses and tutorials

Notes

@knbknb
knbknb / gephi-2-visjs.R
Last active December 9, 2018 16:42
Creates a static HTML/JS page with pretty network-diagram of twitter data (captured by gephi)
# create pretty network-diagram of tweets,
# captured with Gephi's Twitter plugin,
# exported as JSON
# knbknb 20181218
#
library(visNetwork)
library(readr)
workdir <- "/home/knut/gephi/"
# infile created with "Export as ..." Feature of Gephi Desktop App
@knbknb
knbknb / gephi-2-igraph-2-visjs.R
Created December 9, 2018 17:23
Create pretty network-diagram of tweets with visjs, after custom filtering. (WORK IN PROGRESS)
# create pretty network-diagram of tweets,
# captured with Gephi's Twitter plugin,
# exported as JSON
# with more sophisticated filtering
# knbknb 20181209
library(visNetwork)
library(tidyverse)
workdir <- "/home/knut/gephi/"
# infile created with "Export as ..." Feature of Gephi Desktop App