Jackeoz' personal website

Home

Ubuntu fixes and tricks

that I was storing in a .txt file somewhere. I'll leave it in monospace because that's how I formatted it as plain text. I might make it prettier later, but I doubt it.
      When reinstalling ubuntu, do not
      choose the option to install
      proprietary drivers automatically,
      apparently the installer messes up.
      It only has worked correctly when I do
      it manually post-installation.
      After updating and upgrading,
      the packages are

      bcmwl-kernel-source (for wifi drivers)
      ubuntu-restricted-extras (for mp3, mp4 etc)
      


      MY SETUP:
        Basic stuff:
          gnome-tweaks (swap Ctrl with CapsLock)
          vim
          vim-gtk3 (to get clipboard support)
          git
          stylus labs write
          texlive (follow 3.4.1 in the documentation after installation)
          trash-cli
        
        Terminal settings:
          disable terminal bell
          set font to monospace 10

        Inside of vim:
          install vim-plug (requires curl and git, see instructions at github)
          configure vimtex and ultisnips (See Guilles Castel guide)
          
        Theorem proving:
          vscode and lean
          doom emacs and agda

        To make osu work:
          open tablet driver
          FUSE 
          osu-lazer

        enable "use autoscrolling" in firefox
        
        my ll alias and colours (add in ~/.bashrc)
          alias ll='ls -alFh --group-directories-first'
          LS_COLORS=$LS_COLORS:'di=1;36:ln=35:so=32:pi=33:ex=31:mi=30;41:*.tex=33:*.pdf=34' ; export LS_COLORS

      EXTRA STUFF
        Xournal
        Calibre
        Inkscape
        Okular
        Stellarium
        SimpleScreenRecorder
        Telegram
        Signal
        Krita

      FIXES:

        If the system insists on using external microphone when plugging
        headphones in (even when there is none) one solution is installing
        hdajackretask
        for example, from
        alsa-tools-gui
        and overriding the external mic jack to Not Connected.
        This would need to be done after logging in every time.
        To make it permanent, use the option
        install boot override
        Read documentation:
        https://github.com/alsa-project/alsa-tools/blob/master/hdajackretask/README
        Note: Supposedly it's not good to run hdajackretask with sudo.

        the gnome wacom driver messes up with open tablet driver
        to turn it off, one can remove the module with
        sudo rmmod wacom
        everytime we log in.
        However, this only removes the wacom module,
        to remove the unused dependent modules, use
        sudo modprobe -r wacom
        To remove the module permanently, add a conf file in
        /etc/modprobe.d/
        for example,
        /etc/modprobe.d/blacklist-wacom-module.conf
        with the contents
        blacklist wacom
        this procedure works for this particular module, but it can
        fail for other modules if they have dependencies.
        Look at
        https://www.dotlinux.net/blog/how-to-blacklist-a-module-on-ubuntu-debian-linux/
        and
        https://www.man7.org/linux//man-pages/man8/modprobe.8.html


        to check status of wireless driver, run
        sudo 'lshw -C network'
        if it shows something like "not claimed" there is no driver or
        it isn't working properly.
        One must install proprietary drivers, e.g.
        bcmwl-kernel-source
        After installing the package, there will be instructions to
        set up a password and one will need to restart, at boot one
        should input the password from the previous step and the
        system will restart again, this time booting up normally, then
        the wifi card should work.

        run 'dmesg' to check bluetooth status
          fix: copy the related firmware file to /lib/firmware/brcm
          from the winterheart/broadcom-bt-firmware GIT repository.
          source:
          https://www.nielsvandermolen.com/bluetooth-headphones-ubuntu/
        something about ubuntu bluetooth
        https://dev-pages.info/ubuntu-bluetooth/

        for headset microphone not working:
          change pulseaudio for pipewire
          source:
          https://askubuntu.com/questions/831331/failed-to-change-profile-to-headset-head-unit

        Fix opera:
          install the chromium-ffmpeg from snap and link one of the
          libffmpeg.so files to opera, for example
          sudo ln -s /snap/chromium-ffmpeg/XX/chromium-ffmpeg-XXXXX/chromium-ffmpeg/libffmpeg.so /usr/lib/x86_64-linux-gnu/opera/

        To restart open tablet driver and make sure gnome is not interfering
        systemctl --user restart opentabletdriver
        removed xserver-xorg-input-wacom
        http://bolide.run/Wiki/FAQ/Linux

      TRICKS:

        open terminal at given path:
        gnome-terminal --working-directory="/path"

        extract pages from pdf:
        pdftk full-pdf.pdf cat 12-15 output outfile_p12-15.pdf
        qpdf full-pdf.pdf --pages . 1-2 . 4-5 -- output.pdf

        it can also put together pages from various pdf
        qpdf file1.pdf --pages . 1-2 file2.pdf 4-5  file3.pdf 3-8 -- output.pdf
        (the dot stands for file1.pdf)

        analyze startup times:
        systemd-analyze blame

        shell version: $SHELL --version

        add pulse-audio sinks:
        pactl load-module module-null-sink sink_name=MySink
        pactl load-module module-loopback sink=MySink
        pactl unload-module

        convert png to pdf:
        mogrify -format pdf -units PixelsPerInch *png
        one can specify density with -density
          if this doesn't work, edit /etc/ImageMagick-6/policy.xml of
          ImageMagick-6. In that file, change the policy rights to read/write
          
          change to
          

        convert djvu to pdf:
        ddjvu -format=pdf -quality=100 -verbose input.djvu output.pdf

        split big file into parts and paste the parts back:
        split --bytes=1M bigfile bigfile-part
        cat bigfile-part* > bigfile-restored
        
        check that everything went ok:
        diff bigfile bigfile-restored
        or
        md5sum bigfile
        md5sum bigfile-restored

        merge pdf files using ghost script:
        gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dAutoRotatePages=/None -sOutputFile=finished.pdf  file1.pdf file2.pdf
        merge pdf files using pdftk:
        pdftk file1.pdf file2.pdf cat output mergedfile.pdf


        rotate pdf +90 or -90 degrees:
        pdftk input.pdf cat 1-endwest output output.pdf
        pdftk input.pdf cat 1-endeast output output.pdf

        convert mp4 to ogg
        ffmpeg -i input.mp4 -codec:v libtheora -qscale:v 3 -codec:a libvorbis \
          -qscale:a 3 -f ogv output.ogv

        bulk conversion of webp to png:
        find . -name "*.webp" | xargs -I {} dwebp {} -o {}.png

        webm to mp4:
        ffmpeg -i video.webm video.mp4

        images to mp4:
        ffmpeg -framerate 25 -pattern_type glob -i '*.png' -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p output.mp4

        bulk youtube-dl download:
        youtube-dl -x --audio-format vorbis -a lista

        | xargs -I {} program "{}"

        tree -f -a > salida.txt

        recursively move all files in all subdirectories of
        current directory to the directory called "collection"
        find -type f -exec mv {} collection/ \;


        make git store username and password forever:
        git config --global credential.helper store

        make git store username and password for a session:
        git config --global credential.helper cache

        .bash_profile and .bashrc are specific to bash, whereas .profile is
        read by many shells in the absence of their own shell-specific config
        files. (.profile was used by the original Bourne shell).
        .bash_profile or .profile is read by login shells, along with .bashrc;
        subshels read only .bashrc

        zbarimg is a command line tool that can read qr codes
        one can find it in the ubuntu package called zbar-tools

        add to .bashrc to highlight tex bib files:
        LS_COLORS="${LS_COLORS}*.tex=0;33:*.bib=0;37:"

        add to .bashrc to get my preference of ll behaviour
        alias ll='ls -alFh --group-directories-first'

        diff with progress bar added:
        diff -rqs dir1 dir2 | pv -l -s filecount > logfile

        (to get file count use the following command:)
        find dir1 -type f | wc -l
        
        (this is from https://unix.stackexchange.com/questions/111251)

        GIT DIFF:
        between all succesive commits:
        git log -p
        between the last two commits:
        git diff HEAD~1 HEAD
        between m and n commits back:
        git diff HEAD~m HEAD~n
        working copy and staging area:
        git diff
        staging area and latest commit:
        git diff --staged
        working copy a certain commit:
        git diff [commit]

        Color folders in nautilus:
        sudo add-apt-repository ppa:costales/folder-color
        sudo apt-get update
        sudo apt-get install folder-color
        nautilus -q
        uninstall color folders:
        sudo apt remove --autoremove folder-color
        sudo add-apt-repository --remove ppa:costales/folder-color