Skip to content

Instantly share code, notes, and snippets.


Daniele Orru' danydev

View GitHub Profile
danydev /
Created May 21, 2020
Store commands in history only if successful
# README: This allows you to store in your history file only commands
# with a successful status (or forced exited by you with signal 2).
# Put this content in your .zhsrc
# CREDITS: inspired by
# This function will be hooked to zshaddhistory.
# zshaddhistory is called before a history line is saved. See zshmisc(1).
function my_zshaddhistory() {
# Prevent the command from being written to history before it's
# executed; save it to LASTHIST instead. Write it to history
danydev / ssh
Last active Mar 5, 2021
Update iTerm Badge with hostname of the server used to ssh
View ssh
# Script that updates the iTerm Badge with the hostname of the server that you are
# connecting to with ssh.
# Instructions:
# - Put this script in ~/bin/ssh (this will override the default ssh binary)
# - Run 'chmod +x ~/bin/ssh' to give execution permission to the script
# - Open iTerm\Preferences\Profiles, select your profile and put '\(user.current_ssh_host)' in the Badge text box
# - Enjoy!