Skip to content

Instantly share code, notes, and snippets.

@mpan-pl
mpan-pl / buildPrompt-mpan
Created December 1, 2016 05:27
mpan’s bash prompt
#/usr/bin/env bash
# Copyright © 2016 mpan; <https://mpan.pl/>; CC0 1.0
remote=1
if [[ -z "$SSH_CONNECTION" && -z "$SSH_TTY" ]]; then
remote=0
fi
root=0
if [[ -n "$EUID" ]]; then
if [[ "$EUID" == 0 ]]; then
@mpan-pl
mpan-pl / bin8.h
Last active August 16, 2018 20:03
A C macro for converting 8-bit binary representations into actual values
/*
Signing key: 7C848198AE93D3BB
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
*/
// Copyright © 2018 mpan; <https://mpan.pl/>; CC0 1.0 (THIS FILE!)
// This code should be compatible with C11, except for comments which contain
@mpan-pl
mpan-pl / lsd.sh
Created February 9, 2019 04:07
lsd bash script, inspired by Aniket-Pradhan/lsd
#!/usr/bin/env bash
# Copyright © 2019 mpan; <https://mpan.pl/>; CC0 1.0 (THIS FILE!)
declare -ri rows="$(tput lines)"
declare -ri columns="$(tput cols)"
declare -ra codes=(
"$(tput setab 0) "
"$(tput setab 1) "
"$(tput setab 2) "