Skip to content

Instantly share code, notes, and snippets.

View bmegli's full-sized avatar

Bartosz Meglicki bmegli

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

Scenario

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

Ad-hoc solution

@bmegli
bmegli / ubuntu_unnatended_upgrade_state.md
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
bmegli / ffmpeg_record.md
Created January 3, 2023 13:39
FFmpeg script for capturing desktop
cat record.sh
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
bmegli / cmake_gcc_gpp_version.md
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
bmegli / Ubuntu18_04_libgcc_s_so_1_recovery.md
Created February 8, 2022 11:16
Ubuntu 18.04 how to recover from libgcc_s.so.1 dissaster

Motivation

When:

  • 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 libgcc_s.so.1 is misssing.

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

@bmegli
bmegli / MoveGitTagToCommit.md
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 

Source

@bmegli
bmegli / firefox_fix_13012022.md
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
bmegli / vcpkg.md
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
bmegli / performance_powersafe.md
Last active April 5, 2021 08:11
Linux performance/powersafe switching scripts

Scripts

cat performance.sh 
#! /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
bmegli / CMake_3_20_Ubuntu_18_04.md
Last active January 30, 2024 07:32
CMake 3.20 in Ubuntu 18.04 (reversible way)

Motivatation

  • 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