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
#!/bin/bash | |
virsh nodedev-list --cap pci | grep $( echo pci_.*"$(lspci | grep "$1" | awk '{ print $1 }' | tr ':' '_' | tr '.' '_' )" ) | |
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
relpath(){ python -c "import os.path; print os.path.relpath('$1','${2:-$PWD}')" ; } | |
show_latest () { | |
if [ -z "$1" ] | |
then | |
local dir=$PWD | |
else | |
local dir="$1" | |
fi | |
ls --sort=time --reverse "$dir" | tail -1 ; | |
} |
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
#!/bin/bash | |
# Append to ~/.bashrc | |
# Usage: | |
# Default editor from /etc/alternatives/editor: $ nf python ~/scripy.py | |
# Custom editor: $ nf python ~/script.py vi | |
nf() { | |
STR=$( echo "#!"`which "$1"` ) | |
if [ ! -f "$2" ]; then | |
echo $STR > "$2" | |
echo "" >> "$2" |