You are not logged in.
Pages: 1
Thought this might be a fun thread or is this forum just about devuan in general and no community off topic banter?
either way i found these few interesting, lets see yours.
bash-history-top()
{
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
}
cl()
{
echo "$(tput cols)x$(tput lines)"
}
man-to-pdf()
{
man -t "$1" | ps2pdf - "$1.pdf"
}
Last one (man-to-pdf) needs ghostscript installed.
“That which is below is like that which is above, and that which is above is like that which is below, to perform the miracles of one only thing.”
-Hermes Trismegistos
Offline
i use this one to open iso images or usb devices that contain bootable distros with qemu
check_kvm() { [ -e /dev/kvm ] && KVM_FLAG="-enable-kvm -cpu host" }
emu32() { ISO="$1"; check_kvm; QEMU_CMD="sudo qemu-system-i386 ${KVM_FLAG} -m 2560 -drive format=raw,file=$ISO"; `echo $QEMU_CMD` }
emu64() { ISO="$1"; check_kvm; QEMU_CMD="sudo qemu-system-x86_64 ${KVM_FLAG} -m 2560 -drive format=raw,file=$ISO"; `echo $QEMU_CMD` }
alias emu="emu64"
and this one to search and open files in my archives
find-open() {
if [ "$1" ]; then
[ "$2" ] && DIR="$2" || DIR="."
STRING="$(find "$DIR" -iname "*$1*" | fzf)"
[ "$STRING" ] && xdg-open "$STRING"
else
echo "Example: find-open 'STRING' 'PATH' -> lists all matches of 'STRING' in 'PATH' and opens the selection"
echo " if 'PATH' is not defined, find will look in the working directory'"
fi
}
Offline
I use this to launch a QEMU/KVM virtual machine along with virt-viewer and a shared directory (with the path to the disk image as the argument):
function vlaunch {
qemu-system-x86_64 -enable-kvm \
-m 4G \
-cpu host \
-smp cores=4 \
-drive file="$1",format=raw,cache=none,if=virtio \
-soundhw hda \
-vga qxl \
-device virtio-serial-pci \
-device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 \
-chardev spicevmc,id=spicechannel0,name=vdagent \
-spice unix,addr=/tmp/vm_spice.socket,disable-ticketing \
-device nec-usb-xhci,id=usb \
-chardev spicevmc,name=usbredir,id=usbredirchardev1 \
-device usb-redir,chardev=usbredirchardev1,id=usbredirdev1 \
-chardev spicevmc,name=usbredir,id=usbredirchardev2 \
-device usb-redir,chardev=usbredirchardev2,id=usbredirdev2 \
-fsdev local,id=qemu_dev,path=/home/empty/Public,security_model=none \
-device virtio-9p-pci,fsdev=qemu_dev,mount_tag=qemu_mount &
remote-viewer "spice+unix:///tmp/vm_spice.socket"
}
See http://forums.debian.net/viewtopic.php?f=16&t=144775 for more on this.
But that's in $ENV (~/.kshrc) because I use Korn Shell rather than bloaty old bash :-)
Black Lives Matter
Offline
Thanks for contributing.
Ive only played around in qemu a handful of times, im not one for virtualization, id rather use bare metal. Not trying to take away from qemu, it has its place and is a useful piece of software.
As for bash, well it does the job head on a stick. Lazy reply here but ive always found ksh lacking in regards to tab completion, i suppose there is some nifty tricks to be learned to get the functionality of bash-completion. How would one implement equivalents to bash-completion and inputrc for better user interaction or are these more of a limitation / security risk ?
“That which is below is like that which is above, and that which is above is like that which is below, to perform the miracles of one only thing.”
-Hermes Trismegistos
Offline
No, Korn Shell only offers simple completion and has no command option completion (AFAIK). I've never really missed it though.
If you want a fully featured interactive shell then you should try zsh instead, especially with either fizsh or grml's sublime configuration. The latter's completion system is *much* better than the one offered with bash.
EDIT: but don't bother with oh-my-zsh, that's a buggy pile of shite.
Last edited by Head_on_a_Stick (2020-12-05 12:49:06)
Black Lives Matter
Offline
messing around with a minimal exit menu script.
get_exit () {
read -n 1 -p "(e)xit, (r)eboot, (s)hutdown, (l)ock " exit;
case $exit in
e)
pkill xinit;;
r)
sudo reboot;;
s)
sudo poweroff;;
l)
xscreensaver-command -l;;
esac
}
this could be a separate script as well, ive called an xterm using the following line as a keybind from my window manager. This places a small xterm in the center of the screen and all i need do is press whatever button needed or press escape to quit the xterm.
xterm -geo 50x1+400+300 -e exit-menu
Last edited by dice (2020-12-22 14:32:18)
“That which is below is like that which is above, and that which is above is like that which is below, to perform the miracles of one only thing.”
-Hermes Trismegistos
Offline
Other than coloured user, I have this...
alias su='su -'
Last edited by GlennW (2020-12-25 02:09:29)
Offline
Pages: 1