Skip to content

Instantly share code, notes, and snippets.

View awesomebytes's full-sized avatar

Sam Pfeiffer awesomebytes

View GitHub Profile
@awesomebytes
awesomebytes / razer_15_advanced_ubuntu_18.04.md
Created July 26, 2021 03:56
Razer 15 Advanced (2021) Ubuntu 18.04 installation (working WIFI and Nvidia)
@awesomebytes
awesomebytes / real_time_program_output_parser.py
Created May 28, 2021 01:46
Parse output in real time of any program in Python efficiently
#!/usr/bin/env python
# To make Python 2.7 print an actual function
from __future__ import print_function
import subprocess
# shlex takes care of splitting a string representing a command in words for subprocess
import shlex
import os
class RealTimeProgramOutputParser(object):
@awesomebytes
awesomebytes / install_ubuntu_18.04.05_on_alienware_15_r3_year_2020.md
Last active May 25, 2021 06:39
How to install Ubuntu 18.04.05 on Alienware 15 R3 (2020)

How to install Ubuntu 18.04.05 on Alienware 15 R3 (year 2020 edition)

Let windows install

Just next, next, next filling up your data.

I needed to shutdown the machine on a screen that seemed stuck forever. After starting again it all worked normally and got into Windows.

I found the Dell update application and installed all available updates (as I will probably never boot into Windows again).

Shrink the disk

@awesomebytes
awesomebytes / rewrite_header.md
Created April 27, 2021 02:56
Rewrite header with topic tools transform
rosrun topic_tools transform /h5/thruster_manager/put_stamped /h5/thruster_manager/input_stamped_base_link geometry_msgs/WrenchStamped 'geometry_msgs.msg.WrenchStamped(header=std_msgs.msg.Header(seq=0,stamp=rospy.Time.now(),frame_id="base_link"), wrench=m.wrench)' --import std_msgs geometry_msgs rospy
@awesomebytes
awesomebytes / ipython_tricks.md
Last active April 1, 2021 02:26
Compilation of ipython features or tricks I use to help developing/exploring

Ipython tricks

Here I'll describe some ipython tricks to make developing or exploring bugs easier.

First: What is ipython? It's an interactive Python terminal with colours, autocompletion and some additional magic.

Install it with: sudo pip install --upgrade ipython

Autocompletion

Just press TAB to autocomplete almost anything, imports, functions, methods... autocompletion on import

@awesomebytes
awesomebytes / embed_qt_window.py
Created March 17, 2021 10:20
Proof of concept of embedding a different Qt Program Window into a custom Qt window (via PID of the process)
def get_window_id_by_pid(pid):
"""
Get the window ID based on the PID of the process, None if not found.
Uses wmctrl and parses it output to find it
"""
from subprocess import check_output
# Looks like:
# 0x03c00041 0 3498 skipper Mozilla Firefox
# WindowID ? PID USER Window Name
# Needs sudo apt-get install wmctrl -lp
#!/usr/bin/env bash
# Template from https://betterdev.blog/minimal-safe-bash-script-template/
set -Eeuo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1
trap cleanup SIGINT SIGTERM ERR EXIT
@awesomebytes
awesomebytes / Get_type_cpp.md
Created October 27, 2020 23:50
Get variable type user friendly name in C++

How to get the type of a variable in C++

#include <boost/units/detail/utility.hpp>
using boost::units::detail::demangle;
auto demangled_name = demangle(typeid(MY_VARIABLE).name());
std::cout << "variable is of type: '"<< demangled_name << "'" << std::endl;
@awesomebytes
awesomebytes / qt_ssh_x11_forwarding_no_glx_no_egl.md
Created October 21, 2020 02:30
ssh -X with opengl Qt enabled app solution to neither GLX nor EGL are enabled

ssh -X Qt OpenGL error solution

To avoid the following error: QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled when doing X forwarding via SSH one needs to install the following (in the remote machine where you are sshing into). This also solves black screen for me.

# This is needed in the remote machine
sudo apt-get install libegl-mesa0 libglx-mesa0
@awesomebytes
awesomebytes / qt_serialbus.md
Last active February 1, 2023 09:58
Use qt serialbus in ubuntu 18.04 with qt 5.9

Using the Qt serialbus (to access a CAN bus) in Ubuntu 18.04

I was trying to compile a Qt project that uses the Qt serialbus module and it was not configuring when using qmake, the error was: Unknown module(s) in QT: serialbus. So I needed to build qtserialbus myself.

While trying to build it I ran into: fatal error: private/qobject_p.h: No such file or directory.

# Overkill: get all qt-stuff
sudo apt install qml-module-qt-labs-folderlistmodel qml-module-qtquick-extras qml-module-qtquick-controls2 qt5-default libqt5quickcontrols2-5 qtquickcontrols2-5-dev qtcreator qtcreator-doc libqt5serialport5-dev build-essential qml-module-qt3d qt3d5-dev qtdeclarative5-dev qtconnectivity5-dev qtmultimedia5-dev