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.
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 :-)
Brianna Ghey — Rest In Power
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 ?
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)
Brianna Ghey — Rest In Power
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)
Offline
Other than coloured user, I have this...
alias su='su -'
Last edited by GlennW (2020-12-25 02:09:29)
pic from 1993, new guitar day.
Offline
How fast is your system?
Read 32GB zero’s and throw them away.
dd if=/dev/zero of=/dev/null bs=1M count=32768
How fast is fast? :-)
glenn@GamesBox ~ $ dd if=/dev/zero of=/dev/null bs=1M count=32768
32768+0 records in
32768+0 records out
34359738368 bytes (34 GB, 32 GiB) copied, 1.45917 s, 23.5 GB/s
pic from 1993, new guitar day.
Offline
I got 2.9 GB/s with radio stream playing, 3.5 GB/s with radio stream stopped.
Offline
8.8GB/s on a ThinkPad T60. Not bad for 2007.
starbreaker@netzach:~$ time dd if=/dev/zero of=/dev/null bs=1M count=65536
65536+0 records in
65536+0 records out
68719476736 bytes (69 GB, 64 GiB) copied, 7.80361 s, 8.8 GB/s
"Out of order? [BLEEP!] Even in the future nothing works."
desktop: refurbished ThinkCentre M92p (i7, 32GB RAM, 1TB SSD, 2TB HDD)
laptop: refurbished Thinkpad T60 (Core 2 Duo, 3GB RAM, 1TB SSD)
gemini capsule: starbreaker.org
Offline
Pages: 1