Skip to content

Instantly share code, notes, and snippets.

View turboBasic's full-sized avatar
🔮
Focusing

andriy melnyk turboBasic

🔮
Focusing
View GitHub Profile
@tyalie
tyalie / 01_readme.md
Last active November 9, 2024 19:01
Atuin ZSH up/down arrow integration

Simple script for zsh which gives us a more native up/down arrow behavior for the [atuin magial shell history][1] plugin with behavior similar to e.g. [zsh-history-substring-search][2]. This is an improved reimplemtation of [@Nezteb's gist][3] for the same issue.

Behavior

Note

This assumes default keybindings

First and foremost: The script is aware of multiline buffers. So when going up or down, the script will first try to step through the lines of a multiline buffer, before going to the next history entry.

When pressing up the shell will iteratively go through the previous atuin history and have each result directly in the command buffer / command line. Any text in the initial buffer will be used as a search query.

@turboBasic
turboBasic / .zshrc
Last active May 6, 2023 03:05
Zshrc file for zdharma-continuum/zinit framework #zsh #zinit #dotfiles
## Global vars
export LESS='--buffers=128 --HILITE-UNREAD --ignore-case --LONG-PROMPT --max-back-scroll=15 --no-init --quiet --quit-at-eof --quit-if-one-screen --RAW-CONTROL-CHARS --status-column --tabs=4 --window=-4'
export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow --glob "!.git/*"'
export FZF_DEFAULT_OPTS='--height 50% --ansi --info=inline'
export EDITOR='/usr/local/bin/nvim'
## zinit
source ~/.zinit/bin/zinit.zsh
@Red-Eyed
Red-Eyed / logging_config.py
Last active September 11, 2024 15:40
Convenient way to set python logging
from pathlib import Path
import logging
import sys
def set_logger(error_file: Path, info_file: Path):
error_file = Path(error_file).expanduser().resolve()
error_file.parent.mkdir(exist_ok=True, parents=True)
info_file = Path(info_file).expanduser().resolve()
info_file.parent.mkdir(exist_ok=True, parents=True)
@turboBasic
turboBasic / #ansi 256 colors chart.md
Last active February 21, 2021 08:50
Ansi 256 colors chart #pocket #ansi #color
@turboBasic
turboBasic / systemd-journalctl-cheatsheet.md
Last active January 30, 2021 23:27
systemd journalctl cheatsheet #systemd #journalctl #linux

systemd journalctl cheatsheet / tldr

@turboBasic
turboBasic / backup-all-gpg-keys.md
Last active February 18, 2021 02:15
Backup all secret and public keys from GnuPG keyring #gpg

Backup private & public GnuPG keys

Backup

KEY_ID='[email protected]'

cat <<EOF >"${KEY_ID}...pub+sec.asc" \ 
@turboBasic
turboBasic / new-github-repo.sh
Last active January 4, 2021 13:38
create Github repo from command line using Github REST API with correct escaping #shell #git #github
#!/bin/sh
# Create repository in Github with correct escaping in repo name
# Requires {@code GITHUB_TOKEN} env var.
# @return ssh url to created repository which can be used in git clone command
jq --null-input --compact-output \
--arg repo 'my-awesome-project' \
'{name: $repo}' \
| curl \
@turboBasic
turboBasic / groovySplitVsTokenize.groovy
Last active November 28, 2020 07:55
Groovy String split() vs tokenize() #groovy
final List TestCases = [
'/usr/bin/sh',
'//usr/bin/sh',
'usr//bin/sh',
'usr//bin//sh///',
'//',
'/',
' / ',
' // ',
' ',
@turboBasic
turboBasic / create-config-provider-object.md
Last active September 21, 2020 23:07
Create config provider object on master using Job DSL script #jenkins #job-dsl

Create config-provider object using Job DSL

configFiles {
    propertiesConfig {
        id 'conf-0100-properties'
        name 'created-by-dsl-properties'
        content '''
 GIT.COMMITTER_NAME = name
@turboBasic
turboBasic / executeInBash.groovy
Last active September 12, 2021 07:44
Execute complex bash command in Jenkins script console #jenkins #groovy #shell
String DIR = '/data/jenkins/workspace/UISW-C-UI/Daily/c-daily-build'
void executeInBash(String bashCommand) {
java.lang.Process process = ['/bin/bash', '-c', bashCommand].execute()
process.waitFor()
println process.getText()
}
//////