Skip to content

Instantly share code, notes, and snippets.

View ppetraki's full-sized avatar

Peter M. Petrakis ppetraki

View GitHub Profile
@ppetraki
ppetraki / virt-manager_raw_disk_access
Last active March 7, 2021 16:39
virt-manager raw disk access
virt-manager raw disk access
https://forum.level1techs.com/t/cant-setup-physical-disk-storage-pool-through-virt-manager/124073
You may also need to be a member of the "disk" group too
The goal is to be able to run windows off a native NVMe drive so one can run it as a VM and
as a dual boot configuration
To install windows on a raw device, you'll require the virtio scsi driver. Why? because the raw
@ppetraki
ppetraki / !conan-gradle-multiarch-build
Last active February 9, 2023 01:24
gradle plugin to drive conan multi arch android build
title
@ppetraki
ppetraki / youtube-clear-playlist.js
Created July 21, 2019 18:15
youtube-clear-playlist
// kinda works. First attempt at JS ever
// A bit of WIP
var timeout = 500;
var items;
function populateItems() {
items = document.getElementsByClassName("yt-uix-button yt-uix-button-size-default yt-uix-button-default yt-uix-button-empty yt-uix-button-has-icon no-icon-markup pl-video-edit-remove yt-uix-tooltip");
}
@ppetraki
ppetraki / thread_attr.cpp
Last active April 19, 2019 17:31
dump std::thread attributes. Uses neat local printf adapter.
#include <iostream>
#include <thread>
#include <mutex>
#include <cstdio>
#include <pthread.h>
#include <errno.h>
class fmt {
std::string buf_;
@ppetraki
ppetraki / home-dot_local-path.sh
Created April 12, 2019 14:14
Add ~/.local/bin to path for use with pip install --user. Necessary if you wish to use the latest conan from pip.
# shellcheck shell=sh
# INSTALL to /etc/profile.d with perms 644
# Expand $PATH to include the directory to include pip install --user apps
home_local_bin_path="~/.local/bin"
if [ -n "${PATH##*${home_local_bin_path}}" -a -n "${PATH##*${home_local_bin_path}:*}" ]; then
export PATH=$PATH:${home_local_bin_path}
fi
#conanfile.py
from conans import ConanFile, Meson
class KrilliaConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
# ("", "")
requires = "gtest/1.8.1@bincrafters/stable"
generators = "pkg_config", "ycm"
@ppetraki
ppetraki / fetch_gdrive_file.sh
Created November 8, 2017 20:58
allows you do non-interactively download large public files from gdrive
#!/bin/bash
SOURCE="$1"
if [ "${SOURCE}" == "" ]; then
echo "Must specify a source url"
exit 1
fi
DEST="$2"
if [ "${DEST}" == "" ]; then
@ppetraki
ppetraki / qtcreator-run-gdb-via-sudo.patch
Last active February 23, 2016 18:22
qtcreator - run gdb via sudo
--- qtcreator-3.0.1.orig/src/plugins/debugger/gdb/gdbprocess.cpp
+++ qtcreator-3.0.1/src/plugins/debugger/gdb/gdbprocess.cpp
@@ -59,7 +59,11 @@ QByteArray GdbProcess::readAllStandardEr
void GdbProcess::start(const QString &cmd, const QStringList &args)
{
- m_gdbProc.setCommand(cmd, Utils::QtcProcess::joinArgs(args));
+ QStringList sudoArgs;
+ sudoArgs << cmd << args;
+ QString sudoCmd = QString::fromUtf8("/usr/bin/sudo");