Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#From https://stackoverflow.com/a/6599441/149506 | |
import termios, fcntl, sys, os | |
def read_single_keypress(): | |
"""Waits for a single keypress on stdin. | |
This is a silly function to call if you need to do it a lot because it has | |
to store stdin's current setup, setup stdin for reading single keystrokes | |
then read the single keystroke then revert stdin back after reading the | |
keystroke. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set the prompt the way I want it. | |
# git branch name from https://medium.com/@thucnc/how-to-show-current-git-branch-with-colors-in-bash-prompt-380d05a24745 | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
PS1='\u@\h:\w\[[\e[33m\D{%y-%m-%d %H:%M:%S}\e[0m\]]\e[42m\e[30m$(parse_git_branch)\e[0m % ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $profile.CurrentUserAllHosts | |
function prompt { | |
$host.ui.rawui.WindowTitle = ($pwd -split '\\')[-1] # Set the window title to the current directory. | |
# Now prepend the prompt with: | |
# 1. The date, with seconds, | |
Write-Host '' $(Get-Date -f "yyyy-MM-dd HH:mm:ss") '' -NoNewline -BackgroundColor Black -ForegroundColor Green | |
# 2. if in a git repo, the branch name, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Slightliy modified from this Gist: | |
# https://gist.github.com/mbrengel/c823baa45ed21dce86e8b8321c804bcf | |
# Modifications: | |
# 1. Pump everything to standard out | |
# 2. Make file logging optional. | |
# 3. Show module name instead of level. | |
# From the entry point of your program, simply do | |
# import log_setup | |
# log_setup.configure_logging() |