diff --git a/home/.local/scripts/emoji-font-setup.sh b/home/.local/scripts/emoji-font-setup.sh new file mode 100755 index 0000000..f49891f --- /dev/null +++ b/home/.local/scripts/emoji-font-setup.sh @@ -0,0 +1,54 @@ +#!/bin/sh +set -e +if [[ $(id -u) -ne 0 ]] ; then echo "Please run as root" ; exit 1 ; fi + +echo "Setting up Noto Emoji font..." +# Install noto-fonts-emoji repository as the basic emoji font +pacman -S noto-fonts-emoji --needed +# Install powerline-fonts for powerline statusline +pacman -S powerline-fonts --needed +echo "Font packages installed, setting up font-config" +# Make sure noto emojis are preferred font /etc/fonts/local.conf +# another way to do this would be to manually figure out the number and use /etc/fonts/conf.d/01-notosans.conf +# note that the `01` might be too agressive and override other fonts, it is therefore easier to just use `local.conf` +# if you still want to use the manual numbered representation, make sure to store the file into /etc/fonts/conf.avail/XX-notosans.conf +# from which you will then make a symlink pointing to /etc/fonts/conf.d (same name) +echo ' + + + + sans-serif + + Noto Sans + Noto Color Emoji + Noto Emoji + DejaVu Sans + + + + + serif + + Noto Serif + Noto Color Emoji + Noto Emoji + DejaVu Serif + + + + + monospace + + Noto Mono + Noto Color Emoji + Noto Emoji + DejaVu Sans Mono + + + + +' > /etc/fonts/local.conf +# Update font cache +fc-cache -f +echo "Noto Emoji Font installed! You will need to restart application to see changes." + diff --git a/home/.local/scripts/fixcam.sh b/home/.local/scripts/fixcam.sh new file mode 100755 index 0000000..2e44874 --- /dev/null +++ b/home/.local/scripts/fixcam.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Fix camera autofocus and exposure +v4l2-ctl -d /dev/video0 --set-ctrl=focus_auto=0 +v4l2-ctl -d /dev/video0 --set-ctrl=exposure_auto=3 +v4l2-ctl -d /dev/video0 --set-ctrl=sharpness=150 +v4l2-ctl -d /dev/video0 --set-ctrl=exposure_auto_priority=0 diff --git a/home/.local/scripts/install_virtmic.sh b/home/.local/scripts/install_virtmic.sh new file mode 100755 index 0000000..9d3493d --- /dev/null +++ b/home/.local/scripts/install_virtmic.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# This script will create a virtual microphone for PulseAudio to use and set it as the default device. + +# Load the "module-pipe-source" module to read audio data from a FIFO special file. +echo "Creating virtual microphone." +pactl load-module module-pipe-source source_name=virtmic file=$HOME/.config/pulse/audioFiles/virtmic format=s16le rate=16000 channels=1 + +# Set the virtmic as the default source device. +echo "Set the virtual microphone as the default device." +pactl set-default-source virtmic + +# Create a file that will set the default source device to virtmic for all +PulseAudio client applications. +echo "default-source = virtmic" > $HOME/.config/pulse/client.conf + +# Write the audio file to the named pipe virtmic. This will block until the named pipe is read. +echo "Writing audio file to virtual microphone." +while true; do + ffmpeg -re -i input.wav -f s16le -ar 16000 -ac 1 - > $HOME/.config/pulse/audioFiles/virtmic +done diff --git a/home/.local/scripts/uninstall_virtmic.sh b/home/.local/scripts/uninstall_virtmic.sh new file mode 100755 index 0000000..c178f5f --- /dev/null +++ b/home/.local/scripts/uninstall_virtmic.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Uninstall the virtual microphone. + +pactl unload-module module-pipe-source +rm $HOME/.config/pulse/client.conf + diff --git a/home/.local/scripts/usbreset b/home/.local/scripts/usbreset new file mode 100755 index 0000000..56d2f9f Binary files /dev/null and b/home/.local/scripts/usbreset differ diff --git a/home/.local/scripts/usbreset.c b/home/.local/scripts/usbreset.c new file mode 100644 index 0000000..76c30c0 --- /dev/null +++ b/home/.local/scripts/usbreset.c @@ -0,0 +1,40 @@ +/* usbreset -- send a USB port reset to a USB device */ + +#include +#include +#include +#include +#include + +#include + + +int main(int argc, char **argv) +{ + const char *filename; + int fd; + int rc; + + if (argc != 2) { + fprintf(stderr, "Usage: usbreset device-filename\n"); + return 1; + } + filename = argv[1]; + + fd = open(filename, O_WRONLY); + if (fd < 0) { + perror("Error opening output file"); + return 1; + } + + printf("Resetting USB device %s\n", filename); + rc = ioctl(fd, USBDEVFS_RESET, 0); + if (rc < 0) { + perror("Error in ioctl"); + return 1; + } + printf("Reset successful\n"); + + close(fd); + return 0; +}