Skip to content

Instantly share code, notes, and snippets.

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

Knut Behrends knbknb

💭
🙅‍♀️💡💤😴🛌🤪🧔
View GitHub Profile
@knbknb
knbknb / qmd_template_at_a_glance.qmd
Last active June 26, 2023 14:01 — forked from erikerhardt/erik_qmd_template_simple.qmd
A qmd quarto frontmatter and template document, simple
---
title: Title
subtitle: Subtitle
author: # originally: Erik Erhardt
date: last-modified # today, now, last-modified
date-format: long # full, long, medium, short, iso, https://quarto.org/docs/reference/dates.html
format:
html:
theme: litera
highlight-style: atom-one
@knbknb
knbknb / ultimate-ut-cheat-sheet.md
Created March 26, 2023 10:55 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@knbknb
knbknb / cleanup-gitlab-pipelines.sh
Created February 20, 2023 17:18 — forked from chrishoerl/cleanup-gitlab-pipelines.sh
Bulk delete gitlab pipelines older than a given date
#!/bin/bash
# Purpose: Bulk-delete GitLab pipelines older than a given date
# Author: github.com/chrishoerl
# GitLab API: v4
# Requirements: jq must be instaled ($ sudo apt install jq)
# API example: https://gitlab.example.com/api/v4/projects
# API example: https://gitlab.example.com/api/v4/projects/<projectid>/pipelines
#
# NOTE: Script is just a dryrun. To really delete pipelines, simply uncomment line 49 to activate
#
@knbknb
knbknb / ubuntu-custom-setup.sh
Last active March 8, 2023 14:13 — forked from riccardopedrielli/ubuntu-workstation-setup.sh
Ubuntu workstation setup
#!/usr/bin/env bash
set -Eeu
trap 'STATUS=${?}; echo "${0}: Error on line ${LINENO}: ${BASH_COMMAND}"; exit ${STATUS}' ERR
trap 'rm -rf ${tempDir}' EXIT
readonly supportedUbuntuVersion="22.04"
readonly tempDir="/tmp/setup"
readonly devDir="${HOME}/dev"
readonly scriptsDir="${devDir}/scripts"
# benchmarking the new parsnip release 1.0.3 vs previous 1.0.2
#
# forked from: @simonpcouch
# https://gist.github.com/simonpcouch/651d0ea4d968b455ded8194578dabf52
# gist name:simonpcouch/parsnip_speedup.R
# 2022-11-22
#
library(tidymodels)
# with v1.0.2 ------------------------------------------------------------
@knbknb
knbknb / command-line-piping.R
Last active September 22, 2022 10:26 — forked from chasemc/skimr.r
R: data.table::fread's ability to use unix-cmdtool to "stream in" data
# see: https://www.youtube.com/watch?v=RYhwZW6ofbI&t=6s
# R tip #3: use pipe connections
# by jim Hester
library(data.table) # for files < ~10GB
library(skimr) # another summary()
# filter a file: get only lines containing word UNK
wget -O /tmp/YaHei.Consolas.1.12.zip https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/uigroupcode/YaHei.Consolas.1.12.zip
unzip /tmp/YaHei.Consolas.1.12.zip
sudo mkdir -p /usr/share/fonts/consolas
sudo mv YaHei.Consolas.1.12.ttf /usr/share/fonts/consolas/
sudo chmod 644 /usr/share/fonts/consolas/YaHei.Consolas.1.12.ttf
cd /usr/share/fonts/consolas
sudo mkfontscale && sudo mkfontdir && sudo fc-cache -fv
@knbknb
knbknb / doi_resolver.py
Created May 19, 2022 13:31 — forked from mirekys/doi_resolver.py
Resolves a DOI identifier and returns record metadata in JSON format
#!/usr/bin/env python3
# pip install crossrefapi
from crossref.restful import Works
import requests
"""
Simple client for CrossRef DOI content negotiation
Tries to resolve a given DOI with CrossRef API.
If it fails (e.g. DOI is not minted by the CrossRef agency),
@knbknb
knbknb / NodeJS-Cheatsheet.js
Last active April 14, 2022 11:36 — forked from devmoreno/CheatCheat.js
Collection of Node.js Codesnippets, from various sources, 2016
// Node.js CheatSheet.
// Credit:
// forked from Github gist: devmoreno/CheatCheat.js
// source URL: https://gist.github.com/devmoreno/f8db88351bc10e2a82e02dc0b06e68dd
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
@knbknb
knbknb / exa-config.sh
Last active April 10, 2022 09:15 — forked from louiskounios/exa-config.sh
exa useful aliases, and EXA_COLORS (/ LS_COLORS) config
alias ls='exa --classify --across'
alias l='exa --classify --oneline'
alias ll='exa --classify --long --group'
alias llg='exa --classify --long --grid --group'
alias tree='exa --classify --tree'
alias lrt='exa --classify --long --group --sort newest'
# When --long --grid are used at the same time, --grid will only apply if the
# resulting output will be at least EXA_GRID_ROWS long.
export EXA_GRID_ROWS=3