Skip to content

Instantly share code, notes, and snippets.

@dorentus
Last active August 29, 2015 14:00
Show Gist options
  • Select an option

  • Save dorentus/13de4ae03ce7ab5ecbbe to your computer and use it in GitHub Desktop.

Select an option

Save dorentus/13de4ae03ce7ab5ecbbe to your computer and use it in GitHub Desktop.
fancy $PS1
PS1_SYM='\$'
if [ -x $HOME/bin/choose_by_hostname ]; then
PS1_SYM=$($HOME/bin/choose_by_hostname πŸ’Š πŸ‘Ύ 🍏 β­• πŸŒ€ 🌐)
fi
export PS1='\n\[\e[0;30m\]β”Œβ”€\[\e[0m\]\[\e[01;30m\]\u@\h\[\e[00m\]:\[\e[01;34m\]\w\[\e[00m\]\n\[\e[0;30m\]└───\[\e[0m\]${PS1_SYM} \[\e[00;33m\]$(__git_ps1 "(%s)")\[\e[00m\] '
#!/usr/bin/env ruby
require 'socket'
require 'digest/sha1'
symbols = ARGV.join.scan(/.{1}/)
symbols = ['$'] if symbols.empty?
hostname = Socket.gethostbyname(Socket.gethostname).first
hash = Digest::SHA1.hexdigest(hostname).to_i(16)
index = hash % symbols.count
print symbols[index]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment