Skip to content

Instantly share code, notes, and snippets.

@kalkov
kalkov / linux_console_shortcuts.md
Last active October 16, 2023 11:16
Linux console shortcuts

Command Editing Shortcuts

Ctrl+a – go to the start of the command line

Ctrl+e – go to the end of the command line

Ctrl+k – delete from cursor to the end of the command line

Ctrl+u – delete from cursor to the start of the command line

Ctrl+w – delete from cursor to start of word (i.e. delete backwards one word)

@kalkov
kalkov / load-kube-configs.sh
Last active April 13, 2023 08:57
Load multiple symlinked kube config files
#!/usr/bin/env bash
# If there's already a kubeconfig file in ~/.kube/config it will import that too and all the contexts
DEFAULT_KUBECONFIG_FILE="$HOME/.kube/config"
if test -f "${DEFAULT_KUBECONFIG_FILE}"
then
export KUBECONFIG="$DEFAULT_KUBECONFIG_FILE"
fi
# Your additional kubeconfig files should be inside ~/.kube/config-files
@kalkov
kalkov / clickhouse_disk_space_per_table.sql
Last active September 27, 2022 08:21
Handy Clickhouse queries
SELECT
table,
formatReadableSize(sum(bytes)) AS size,
min(min_date) AS min_date,
max(max_date) AS max_date
FROM system.parts
WHERE active
GROUP BY table
ORDER BY sum(bytes) DESC
@kalkov
kalkov / kafka-useful-commands.md
Created June 17, 2021 11:53 — forked from mjuric/kafka-useful-commands.md
Useful Kafka wrangling commands

Utilities you'll care about

All these are already installed on epyc.

  • kafkacat (conda install -c conda-forge kafkacat)

  • kt (grab it from https://github.com/fgeller/kt/releases)

  • kafka-* (come with kafka, if you yum install if from Confluent's repo, or via Docker if you're so inclined). Warning -- JVM based and dreadfully slow.

  • jq (conda install -c conda-forge jq or use your favorite package manager)

@kalkov
kalkov / noark-ex9em.json
Last active November 8, 2020 14:33
Node-red red flow for reading Noark Ex9EM 1P 1M 80A MO MT Electric Meter
[
{
"id":"a845c14d.ab2b9",
"type":"tab",
"label":"Flow 1",
"disabled":false,
"info":""
},
{
"id":"606753ef.2621fc",
@kalkov
kalkov / noark-ex9em-nodered.js
Last active May 20, 2022 12:30 — forked from groupsky/noark-ex9em.js
ModBus read for Noark Ex9EM 1P 1M 80A MO MT
const data = msg.payload
const voltage = data[0]*0.1
const current = data[1]*0.1
const phase = data[2]*0.1
const power = data[3]
const power_reactive = data[4]
const power_apparent = data[5]
const power_efficiency = data[6]*0.1
const total_power = (data[7] * (1 << 16) + data[8]) / 100
@kalkov
kalkov / settings.json
Created January 6, 2020 12:56
VS code config
# place in ~/.config/Code/User/settings.json
{
"editor.rulers": [100,117],
"workbench.activityBar.visible": false,
"editor.minimap.enabled": false,
"workbench.statusBar.feedback.visible": false,
"window.zoomLevel": 0,
"breadcrumbs.enabled": true,
"files.exclude": {
"**/*.pyc": true
@kalkov
kalkov / install virtualenv ubuntu 16.04.md
Created October 1, 2019 15:12 — forked from frfahim/install virtualenv ubuntu 16.04.md
How to install virtual environment on ubuntu 16.04

How to install virtualenv:

Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv 
@kalkov
kalkov / tlp
Created August 21, 2019 09:09 — forked from pauloromeira/tlp
My TLP config file (/etc/default/tlp) for ThinkPad
# ------------------------------------------------------------------------------
# tlp - Parameters for power saving
# See full explanation: http://linrunner.de/en/tlp/docs/tlp-configuration.html
# dir: /etc/default/tlp
# Hint: some features are disabled by default, remove the leading # to enable
# them.
# Set to 0 to disable, 1 to enable TLP.
@kalkov
kalkov / curl.md
Created November 7, 2018 09:36 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.