cleanup script folder
This commit is contained in:
parent
45a48d1561
commit
96108823da
|
@ -157,7 +157,7 @@ bindsym $mod+w layout tabbed
|
|||
bindsym $mod+e layout toggle split
|
||||
|
||||
# toggle tiling / floating
|
||||
bindsym $mod+Shift+space exec center-float
|
||||
bindsym $mod+Shift+space floating toggle
|
||||
|
||||
# toggle sticky
|
||||
bindsym $mod+Ctrl+space sticky toggle
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -- \
|
||||
$(i3-msg -t get_workspaces | jq --raw-output '. | map(select(.focused == true)) | .[].rect | [.width, .height] | @sh')
|
||||
i3-msg -q floating toggle
|
||||
i3-msg -q resize set $(( $1/3*2 )) $(( $2/3*2 ))
|
||||
i3-msg -q move absolute position center
|
|
@ -1,80 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#pvid: streamlink wrapper
|
||||
|
||||
print_help() {
|
||||
echo "A streamlink wrapper"
|
||||
echo ""
|
||||
echo "Usage: emp [options] url"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -h, --help Print this help text"
|
||||
echo " -b, --bg Play the video on the root window"
|
||||
echo " -a, --audio Play only the audio"
|
||||
echo ""
|
||||
exit 0
|
||||
}
|
||||
|
||||
short_args=hba
|
||||
long_args=help,bg,audio
|
||||
|
||||
# default
|
||||
default_stream="best"
|
||||
mpv_cmd="mpv"
|
||||
player_args="--wid="$(xdotool getactivewindow)""
|
||||
streamlink_args="--retry-stream 30"
|
||||
|
||||
# Parse arguments
|
||||
parsed_args=$(getopt --options $short_args --longoptions $long_args --name "$0" -- "$@")
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to parse arguments"
|
||||
exit 2
|
||||
fi
|
||||
eval set -- "$parsed_args"
|
||||
while true; do
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
print_help
|
||||
;;
|
||||
-b|--bg)
|
||||
a=y
|
||||
streamlink_args="$streamlink_args --quiet"
|
||||
mpv_cmd="xwinwrap -ov -fs -- mpv"
|
||||
player_args="--no-osc --wid WID"
|
||||
shift
|
||||
;;
|
||||
-a|--audio)
|
||||
a=y
|
||||
streamlink_args="$streamlink_args --quiet"
|
||||
player_args="--no-video"
|
||||
shift
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
#the following args will be passed to streamlink
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$@" ]]; then
|
||||
print_help
|
||||
fi
|
||||
|
||||
streamlink \
|
||||
$streamlink_args \
|
||||
--default-stream "$default_stream" \
|
||||
--player="$mpv_cmd" \
|
||||
--player-args "$player_args -- {filename}" \
|
||||
$@ &
|
||||
|
||||
if [[ -n "$a" ]]; then
|
||||
cava
|
||||
fi
|
||||
|
||||
wait
|
||||
exit $?
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#mount_dir="$(mktemp -d /tmp/ramdisk.XXXX)"
|
||||
mount_dir="/tmp/ramdisk"
|
||||
mkdir "$mount_dir"
|
||||
img_file="$mount_dir/img"
|
||||
|
||||
if [[ ! -f "$1" ]]; then
|
||||
echo "'$1' is an invalid file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# create tmpfs and copy the file on it
|
||||
img_size="$(stat --printf="%s" "$1")"
|
||||
sudo mount -t tmpfs size=$img_size,noexec,nosid,uid=$UID,gid=$GID "$mount_dir"
|
||||
cp "$1" "$img_file"
|
||||
|
||||
read -p "press enter to unmount"
|
||||
|
||||
# check if the file is in use
|
||||
while lsof "$mount_dir" | grep -q "$mount_dir"; do
|
||||
echo "Device is busy"
|
||||
read -p "press enter to unmount"
|
||||
done
|
||||
|
||||
# save the image to disk
|
||||
if cp "$img_file" "$1.tmp"; then
|
||||
mv "$1.tmp" "$1"
|
||||
else
|
||||
echo "Error copying '$img_file' back to disk!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# cleanup
|
||||
sudo umount "$mount_dir"
|
||||
rmdir "$mount_dir"
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
exec xwinwrap -ov -fs -- mpv --no-osc --no-stop-screensaver --wid WID $@
|
|
@ -1,69 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
export QEMU_AUDIO_DRV=pa
|
||||
export QEMU_PA_SAMPLE=1024
|
||||
export QEMU_AUDIO_TIMER_PERIOD=150
|
||||
export QEMU_PA_SERVER=/run/user/1000/pulse/native
|
||||
|
||||
# defrag ram
|
||||
sudo sh -c "echo 1 > /proc/sys/vm/compact_memory"
|
||||
# assign hugepages
|
||||
sudo sysctl -w vm.nr_hugepages=8192
|
||||
|
||||
# start qemu
|
||||
qemu-system-x86_64 -name win10 -S \
|
||||
-machine q35,accel=kvm -device intel-iommu \
|
||||
-cpu host,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1fff,hv_vendor_id=0xDEADBEEFFF,kvm=off \
|
||||
-smp 6,sockets=1,cores=3,threads=2 \
|
||||
-m 16G -mem-prealloc -mem-path /dev/hugepages/libvirt/qemu/win10 \
|
||||
-drive file=/usr/share/ovmf/x64/OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on \
|
||||
-realtime mlock=off \
|
||||
-uuid 9d7df055-d6d1-4551-bb25-ef2ddb835c4d \
|
||||
-no-user-config \
|
||||
-rtc base=localtime,driftfix=slew \
|
||||
-global kvm-pit.lost_tick_policy=delay \
|
||||
-no-hpet -no-shutdown \
|
||||
-global ICH9-LPC.disable_s3=1 \
|
||||
-global ICH9-LPC.disable_s4=1 \
|
||||
-boot strict=on \
|
||||
-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
|
||||
-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
|
||||
-device pcie-root-port,port=0x10,chassis=3,id=pci.3,bus=pcie.0,multifunction=on,addr=0x2 \
|
||||
-device pcie-root-port,port=0x11,chassis=4,id=pci.4,bus=pcie.0,addr=0x2.0x1 \
|
||||
-device pcie-root-port,port=0x12,chassis=5,id=pci.5,bus=pcie.0,addr=0x2.0x2 \
|
||||
-device pcie-root-port,port=0x13,chassis=6,id=pci.6,bus=pcie.0,addr=0x2.0x3 \
|
||||
-device pcie-root-port,port=0x14,chassis=7,id=pci.7,bus=pcie.0,addr=0x2.0x4 \
|
||||
-device pcie-root-port,port=0x15,chassis=8,id=pci.8,bus=pcie.0,addr=0x2.0x5 \
|
||||
-device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x1d.0x7 \
|
||||
-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,addr=0x1d \
|
||||
-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x1d.0x1 \
|
||||
-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x1d.0x2 \
|
||||
-device virtio-scsi-pci,id=scsi0,num_queues=6,bus=pci.5,addr=0x0 \
|
||||
-device virtio-serial-pci,id=virtio-serial0,bus=pci.3,addr=0x0 \
|
||||
-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 \
|
||||
-drive file=$HOME/Documents/virtualmachines/img/win10.img,format=raw,if=none,id=drive-scsi0-0-0-0 \
|
||||
-drive file=/dev/disk/by-label/DATA,format=raw,if=none,id=drive-scsi0-0-0-3,cache=none,aio=native \
|
||||
-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=3,drive=drive-scsi0-0-0-3,id=scsi0-0-0-3,write-cache=on \
|
||||
-drive if=none,id=drive-sata0-0-1,media=cdrom,readonly=on \
|
||||
-device ide-cd,bus=ide.1,drive=drive-sata0-0-1,id=sata0-0-1 \
|
||||
-chardev spicevmc,id=charchannel0,name=vdagent \
|
||||
-device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 \
|
||||
-spice unix,addr=/tmp/win10.sock,disable-ticketing,image-compression=off,seamless-migration=on \
|
||||
-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,max_outputs=1,bus=pcie.0,addr=0x1 \
|
||||
-device intel-hda,id=sound0,bus=pci.2,addr=0x2 \
|
||||
-device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 \
|
||||
-chardev spicevmc,id=charredir0,name=usbredir \
|
||||
-device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=2 \
|
||||
-device usb-host,hostbus=1,hostaddr=3,id=hostdev0,bus=usb.0,port=1 \
|
||||
-device vfio-pci,host=01:00.0,id=hostdev1,bus=pci.6,addr=0x0 \
|
||||
-device vfio-pci,host=00:1f.6,id=hostdev2,bus=pci.2,addr=0x3 \
|
||||
-device usb-host,hostbus=1,hostaddr=11,id=hostdev3,bus=usb.0,port=3 \
|
||||
-device virtio-balloon-pci,id=balloon0,bus=pci.7,addr=0x0 \
|
||||
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
|
||||
-object memory-backend-file,id=shmmem-shmem0,mem-path=/dev/shm/looking-glass,size=33554432,share=yes \
|
||||
-device ivshmem-plain,id=shmem0,memdev=shmmem-shmem0,bus=pci.2,addr=0x4 \
|
||||
-msg timestamp=on
|
||||
|
||||
# free hugepages
|
||||
sudo sysctl -w vm.nr_hugepages=0
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Animated wallpaper
|
||||
# quick and dirty script, but it works
|
||||
|
||||
wallpaper_source="https://massaki.ca/extra/wallpaper.mp4"
|
||||
wallpaper_static="$HOME/.local/share/wallpaper.jpg"
|
||||
wallpaper_anim="$HOME/.local/share/wallpaper.mp4"
|
||||
|
||||
if [ ! -f "$HOME/.cache/wallpaper_enabled" ]; then
|
||||
echo "Animated wallpaper disabled"
|
||||
echo "touch $HOME/.cache/wallpaper_enabled to enable it"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ ! -f "$wallpaper_anim" ]; then
|
||||
# calculate screen geometry
|
||||
screen_size="$(xrandr --screen 0 | grep '^Screen' | grep -Eo 'current [0-9]+ x [0-9]+' | sed -E 's/current ([0-9]+) x ([0-9]+)/\1 \2/g')"
|
||||
set -- $screen_size
|
||||
|
||||
# download, crop and scale
|
||||
ffmpeg -i "$wallpaper_source" -vf "scale=w=$1:h=$2:force_original_aspect_ratio=increase, crop=w=$1:h=$2:y=(in_w-out_w)" -sws_flags lanczos \
|
||||
-c:v libx264 -tune fastdecode -preset ultrafast -crf 18 -r 15 "$wallpaper_anim"
|
||||
|
||||
# extract static image
|
||||
ffmpeg -i "$wallpaper_anim" -vframes 1 "$wallpaper_static"
|
||||
|
||||
# set static wallpaper
|
||||
feh --bg-fill --no-xinerama "$wallpaper_static"
|
||||
fi
|
||||
|
||||
if ! acpi --ac-adapter 2>/dev/null | grep -q 'off-line'; then
|
||||
exec "$HOME/.local/bin/mpv-bg" --really-quiet \
|
||||
--no-config --no-border --no-audio --vd-lavc-fast \
|
||||
--loop --panscan=1.0 --scale=oversample --cache-file=TMP "$wallpaper_anim"
|
||||
fi
|
Loading…
Reference in New Issue