Skip to content

Instantly share code, notes, and snippets.

View turboBasic's full-sized avatar
🔮
Focusing

andriy melnyk turboBasic

🔮
Focusing
View GitHub Profile
@turboBasic
turboBasic / #ansi 256 colors chart.md
Last active February 21, 2021 08:50
Ansi 256 colors chart #pocket #ansi #color
@turboBasic
turboBasic / .profile
Last active January 31, 2021 00:46
pam_env.so - ~/.pam-environment log #pam #linux
LOG_FILE=pam-environment-01.log.md
exec 3>&1
exec 1>> "$LOG_FILE"
printf '\n\n\nLOGIN %s\n=====================\n' "$(date +%Y%m%d-%H%M%S)"
printf '\n\n%s\n----------------\n' .pam_environment
printf '```ini\n'
grep -C2 -- AVAR .pam_environment
@turboBasic
turboBasic / sampleREADME.md
Created January 30, 2021 22:27 — forked from FrancesCoronel/sampleREADME.md
A sample README for all your GitHub projects.

FVCproductions

INSERT GRAPHIC HERE (include hyperlink in image)

Repository Title Goes Here

Subtitle or Short Description Goes Here

@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 / copyToOtherUserHome.sh
Created January 26, 2021 01:46
Copy files to other user's home #bash
#!/usr/bin/env bash
DEST_USER=${DEST_USER:-user}
DEST_DIR=${DEST_DIR:-/home/$DEST_USER}
files="$(
sudo --login --non-interactive --user $DEST_USER -- \
bash -c "find -maxdepth 1 -type f \\(
-name .profile -o -name .zprofile -o -name .bash\\* -o -name .zsh\\*
\\)"
@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 / convertSshFingerprint.md
Last active January 24, 2021 09:40
Convert OpenSSH public key fingerprints to different formats #ssh #openssh

Convert SHA256 OpenSSH digests to other representations

➜  ssh-add -l
256 SHA256:DpDdSJhFYZAa1jz4cE9PMAevia1C/yb4Gi5nW7dMqmw [email protected] (ED25519)
@turboBasic
turboBasic / getLocaleDiff.sh
Last active January 21, 2021 14:19
Get detailed difference between two locales #locale #linux
#!/usr/bin/env bash
locale1=${1:-uk_UA.UTF-8}
locale2=${2:-ru_UA.UTF-8}
shopt -s nocasematch
if [[ $locale1 != POSIX ]] \
&& [[ ! $locale1 =~ ' '$ ]] \
&& [[ ! $locale1 =~ @.+$ ]] \
@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 / Add-multiple-exit-traps-to-bash.md
Last active December 17, 2020 17:16
Add multiple exit traps to Bash program #bash

Add multiple exit traps to Bash program

extract_trap_cmd() { printf '%s\n' "${3-}"; }
get_exit_trap_cmd() {
    eval "extract_trap_cmd $(trap -p EXIT)"
}