Skip to content

Instantly share code, notes, and snippets.

View GreyTeardrop's full-sized avatar

Mykola Rybak GreyTeardrop

  • Ukraine, Kyiv
  • 18:18 (UTC +03:00)
View GitHub Profile
@nat-418
nat-418 / nix-home-manager-neovim-setup.md
Last active May 8, 2024 07:40
Manage Neovim plugins (and more!) with Nix and Home Manager

Manage Neovim plugins (and more!) with Nix and Home Manager

Highly extensible software like Emacs, Vim, and Neovim tend to grow their own package managers. A software developer, for example, might want to install editor plugins that hook into a particular programming language's linter or language server. The programmer's text editor is therefore extended to support managing additional software to extend the text editor. If this loop continues for too long, the programmer's editor becomes more delicate and complex. The remedy for this problem is to manage software using dedicated tools apart

@okets
okets / gist:b2bdf3ba2ab96c27ad58274372298261
Last active January 8, 2024 00:10
figure out the room Valetudo robot is right now.
const mapData = msg.payload;
const _pixelSize = mapData.pixelSize;
let _robotXY = null;
for (let i = 0; i < mapData.entities.length; i++) {
if (mapData.entities[i].type == "robot_position") {
_robotXY = {
x: Math.floor(mapData.entities[i].points[0] / _pixelSize),
y: Math.floor(mapData.entities[i].points[1] / _pixelSize)
};
break;
@crazy-max
crazy-max / Caddy.env
Last active May 13, 2024 17:45
Proxmox web interface through Caddy as reverse proxy with Let's Encrypt
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_HOSTED_ZONE_ID=
@elizarov
elizarov / DeepRecursiveFunction.kt
Last active March 25, 2024 00:40
Defines recursive function that keeps its stack on the heap (productized version)
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
/**
* Defines deep recursive function that keeps its stack on the heap,
* which allows very deep recursive computations that do not use the actual call stack.
* To initiate a call to this deep recursive function use its [invoke] function.
* As a rule of thumb, it should be used if recursion goes deeper than a thousand calls.
*
* The [DeepRecursiveFunction] takes one parameter of type [T] and returns a result of type [R].
@yinzara
yinzara / github_bitbucket_multiple_ssh_keys.md
Last active May 2, 2024 23:08
Managing SSH keys and repo cloning using multiple accounts on GitHub and BitBucket

Why Multiple SSH keys?

There are numerous reasons you may need to use multiple SSH keys for accessing GitHub and BitBucket

You may use the same computer for work and personal development and need to separate your work.

When acting as a consultant, it is common to have multiple GitHub and/or BitBucket accounts depending on which client you may be working for.

You may have different projects you're working on where you would like to segregate your access.

@solarfl4re
solarfl4re / yt_save_video.py
Last active January 8, 2020 23:16
For Pythonista 3. Needs StaSH and youtube-dl (installed with pip). Save YouTube vides by long-pressing links and running this script with 'Run Pythonista 3 Script...'
# coding: utf-8
from __future__ import unicode_literals
import appex
import console
from os import remove
import youtube_dl
def main():
if not appex.is_running_extension():
@chaines27
chaines27 / homebrew-openjdk-configuration
Last active June 14, 2022 08:29
Configuration for homebrew-openjdk for macOS to see it as an installed JVM
OpenJDK 1.8
1. Follow the instructions from https://github.com/AdoptOpenJDK/homebrew-openjdk to tap and install jdk8.
2. Run the following command to create the necessary directories
sudo mkdir /Library/Java/JavaVirtualMachines/openjdk-1.8.0_172.jdk
sudo mkdir /Library/Java/JavaVirtualMachines/openjdk-1.8.0_172.jdk/Contents
sudo mkdir /Library/Java/JavaVirtualMachines/openjdk-1.8.0_172.jdk/Contents/MacOS
3. Run the following commands to link to the existing homebrew-openjdk install
@elizarov
elizarov / Debounce.kt
Last active August 26, 2019 00:19
Debounce
import kotlinx.coroutines.experimental.DefaultDispatcher
import kotlinx.coroutines.experimental.channels.ReceiveChannel
import kotlinx.coroutines.experimental.channels.consumeEach
import kotlinx.coroutines.experimental.channels.produce
import kotlinx.coroutines.experimental.delay
import kotlinx.coroutines.experimental.runBlocking
import kotlin.coroutines.experimental.CoroutineContext
fun <T> ReceiveChannel<T>.debounce(
wait: Long = 300,
@gregopet
gregopet / debate.adoc
Last active June 19, 2023 19:19
Validation library requirements

What I expect from a validation library

I’m documenting for myself what I would look for in a validation library. The code I currently need it for is in Kotlin so I have the entire JVM ecosystem to choose from.

JSR 303 and JSR 349

Certainly well battle tested but I dislike the annotations approach; while nice for simple validations it can get hairy when testing real scenarios:

@jwilson8767
jwilson8767 / install_WSL_docker.sh
Last active May 14, 2020 17:17
Docker Toolbox for Windows and Windows Subsystem for Linux (aka Bash on Windows)
#
# This script installs and configures WSL to work with Docker Toolbox for Windows.
# 1. Install WSL (check out [bowinstaller](https://github.com/xezpeleta/bowinstaller) for programmatic installation.
# 2. Run the contents of this script in Bash. (copy and paste works fine, no need to save)
#
sudo -sEH << 'EOM'
# Install the docker client and docker-compose
apt-get update && apt-get install -y curl ca-certificates
curl -sSL https://get.docker.com/ | sh
curl -L "https://github.com/docker/compose/releases/download/1.11.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose