Skip to content

Instantly share code, notes, and snippets.

View bmegli's full-sized avatar

Bartosz Meglicki bmegli

  • Poland
View GitHub Profile
bmegli /
Created March 17, 2024 13:18
route traffic from A over B network interfaces to C


# B has 2 network interaces, A reachable through one, C reachable through other
# We want A to C communiation (over B)

Ad-hoc solution

bmegli /
Created August 18, 2023 10:45
Ubuntu unnatended upgrade state (`Waiting for cache lock...`)

Checking Status

# check service status
sudo systemctl status unattended-upgrades
# check service log
journalctl --unit unattended-upgrades
bmegli /
Created January 3, 2023 13:39
FFmpeg script for capturing desktop
set -x
ffmpeg -video_size 1920x1080 -framerate 30 -f x11grab -draw_mouse 0 -i :1 -c:v libx264 -crf 0 -preset ultrafast ~/Videos/$1
bmegli /
Created April 6, 2022 12:53
CMake with certain gcc/g++ version
# e.g for gcc-6 and g++-6
export CC=/usr/bin/gcc-6
export CXX=/usr/bin/g++-6
cmake ..
make -j8
bmegli /
Created February 8, 2022 11:16
Ubuntu 18.04 how to recover from dissaster



  • using newer compilers from Ubuntu test ppa (e.g. ppa:ubuntu-toolchain-r/test)
  • ppa-purge later to revert the system to clean state

it is possible to get to dissastrous state where is misssing.

In such state apt and other applications may not work and system will not boot.

bmegli /
Created February 1, 2022 09:36
Moving git tag to different commit
git tag -d <tagname>                  # delete the old tag locally
git push origin :refs/tags/<tagname>  # delete the old tag remotely
git tag <tagname> <commit>          # make a new tag locally
git push origin <tagname>             # push the new local tag to the remote 


bmegli /
Last active January 13, 2022 09:27
Firefox stuck at 100% CPU no internet - fix (13.01.2022)

Looks like some "time bomb" in Firefox

To workaround:

  1. Open about:config
  2. Search for https3
  3. Disable network.http.http3.enabled
  4. Restart Firefox

Now re-enable network.http.http3.enabled and restart. It should be still working.

bmegli /
Created October 7, 2021 15:28
VCPKG cheatsheat

Unninstalling Packages

# vcpkg_target_triplet is envirnoment variable with triplet name
vcpkg remove package:%vcpkg_target_triplet% --recurse

Installing Packages

bmegli /
Last active April 5, 2021 08:11
Linux performance/powersafe switching scripts


#! /bin/bash
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "performance" > $file; done

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
bmegli /
Last active June 3, 2024 19:09
CMake 3.20 in Ubuntu 18.04 (reversible way)


  • modern CMake is required for building a lot of new software
  • CMake is dependency for many packages (e.g. ROS related)
  • we don't want to remove CMake (which would remove packages that depend on it)
  • we want safe procedure to update CMake that can be reversed easily

Current version in OS

Check current version