Linux

All about Linux kernel and operating systems that are based on it.
[Random post]

 tags  gallery  RSS

23.11.2023 17:05:17

Directly streaming youtube video using yt-dlp and mpv

This way you can avoid any hassle that comes with ads by avoiding them entirely by streaming video content directly to input of your video player such a mplayer or mpv and playing ir directly as shown below. The example below shows video of Never Gonna Give You Up by Rick Astley inside a new video player window.

$ yt-dlp https://www.youtube.com/watch?v=dQw4w9WgXcQ -o - | mpv -

reposted by raumfahrtagentur
6.7.2023 22:38:37

Spamming random symbols to unix terminal while in virtual machine.

30.12.2022 17:55:08

Linux terminal corruption

Caused by writing some non-printable characters to the terminal output


reposted by juozaspo
20.9.2022 15:42:11

Ubuntu 22.04 has an annoying apt bug. It does not properly upgrade all packages

Running apt in dist-upgrade mode generates weird results as some packages are not upgraded. The only solution is to manually add each not upgraded package to command line which is super annoying and wastes precious time :\ The following behavior is what reproduces faulty results:

juozas@xubuntu:~$ export LC_ALL=C
juozas@xubuntu:~$ sudo apt-get --no-install-recommends dist-upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  linux-headers-5.15.0-46 linux-headers-5.15.0-46-generic linux-image-5.15.0-46-generic linux-modules-5.15.0-46-generic linux-modules-extra-5.15.0-46-generic
  linux-tools-5.15.0-46 linux-tools-5.15.0-46-generic
Use 'sudo apt autoremove' to remove them.
The following packages have been kept back:
  fonts-opensymbol libreoffice libreoffice-base libreoffice-base-core libreoffice-base-drivers libreoffice-calc libreoffice-common libreoffice-core
  libreoffice-draw libreoffice-gtk libreoffice-gtk2 libreoffice-gtk3 libreoffice-help-common libreoffice-help-en-gb libreoffice-help-en-us libreoffice-impress
  libreoffice-l10n-en-gb libreoffice-l10n-en-za libreoffice-l10n-lt libreoffice-math libreoffice-report-builder-bin libreoffice-style-colibre libreoffice-writer
  libuno-cppu3 libuno-cppuhelpergcc3-3 libuno-purpenvhelpergcc3-3 libuno-sal3 libuno-salhelpergcc3-3 python3-uno uno-libs-private ure
0 upgraded, 0 newly installed, 0 to remove and 31 not upgraded.
juozas@xubuntu:~$

Edit: It appers this is a new apt feature called phased updates. It can be easily disabled by adding

APT::Get::Always-Include-Phased-Updates "true";

to apt configuration (usually in /etc/apt/apt.conf.d/).


reposted by juozaspo raumfahrtagentur
16.5.2022 19:04:17

A quick fight game made in bash

#!/bin/bash
health=10
enemy=10
while [[ $health > 0 && $enemy > 0 ]]
do
echo You: $health
echo Enemy: $enemy
input=
while [[ $input != 0 && $input != 1 ]]
do
echo "Pick a number (0-1)"
read input
if [[ $input != 0 && $input != 1 ]]; then
echo "Wrong input"
fi
done
hit=$(( $RANDOM % 2 ))
if [[ $input == $hit ]]; then
((enemy--))
else
((health--))
fi
done
if [[ $health == 0 ]]; then
echo "You Died"
else
echo "You defeated the beast"
fi

Save this as a file named fight.sh onto any linux system, chmod +x it, run it and have fun

13.4.2022 20:32:11

Installed Ubuntu 22.04 LTS from scratch, to be released within a week (April 21, 2022)

Ubuntu 22.04 LTS is soon to be released so I decided to do a complete reinstall. After booting into Linux Live USB first I've deleted everything from my old install except for the important stuff I needed to keep. Then I've reinstalled the base system using debootstrap and used a script I made to enter the chroot, I installed required packages there to make it boot and to be able to access network. Finally I've installed everything else I needed including graphical interface where a list of installed previously packages would help alot. Such list could be generated by running commands as shown in example below.

First generate package list files while in old system as shown below

$ apt-mark showmanual > manual_old.txt
$ dpkg-query -Wf '${Package}\n' > packages_old.txt

After reinstalling system repeat same in the new installation, only change output file names where needed.

$ apt-mark showmanual > manual.txt
$ dpkg-query -Wf '${Package}\n' > packages.txt

Finally compare package list files generated above, a list of missing packages would be stored in files as shown below

$ sort manual_old.txt > 1.txt; sort manual.txt > 2.txt; comm -23 1.txt 2.txt > missing_manual.txt
$ sort packages_old.txt > 1.txt; sort packages.txt > 2.txt; comm -23 1.txt 2.txt > missing.txt

reposted by juozaspo
19.2.2022 21:50:31

Double dollar sign ($$) in bash

It substitutes to PID of the current running shell. For example running

ps -Alf|grep $$

generates interesting results, as shown below

$ ps -Alf|grep $$
0 S juozas     11125   11120  0  80   0 -  3391 do_wai 22:43 pts/0    00:00:00 bash
4 R juozas     11197   11125  0  80   0 -  3506 -      22:46 pts/0    00:00:00 ps -Alf
0 S juozas     11198   11125  0  80   0 -  2859 pipe_w 22:46 pts/0    00:00:00 grep --color=auto 11125

Another example is to use it in the file names where it gets substituted with the PID of the current running shell.

$ cat >f$$.txt <<EOF
This is a test. The pid of running shell is $$
EOF
$ cat f$$.txt
This is a test. The pid of running shell is 11125
$ ls f$$.txt
f11125.txt
$ LC_ALL=C rm -v f$$.txt
removed 'f11125.txt'

reposted by juozaspo
23.12.2021 18:36:36

ffmpeg /dev/urandom test video 4 (mkv, low resolution)

from https://www.youtube.com/watch?v=jFqGCiQyH9Q

19.12.2021 09:14:13

Generate 1280x720 image with 16x9 grid containing random colors in each cell

$ dd if=/dev/urandom bs=1 count=432 of=in.bin

$ convert -depth 8 -size 16x9 rgb:in.bin -scale 1280x out.png


reposted by juozaspo
5.12.2021 09:04:52


reposted by juozaspo memes naich schaaf
 

Timeline speed: 0.42 posts per month

 

You have reached the end...

THE END

login