Skip to content

Instantly share code, notes, and snippets.

View BlurryRoots's full-sized avatar
💭
Remembering the future

Sven Freiberg BlurryRoots

💭
Remembering the future
View GitHub Profile
@BlurryRoots
BlurryRoots / lines-of-code-ratio.sh
Created January 16, 2024 17:09
Investigate the code base and create a ratio of 'lines of code in production' to 'lines of code to produce'
#!/bin/bash
# Copyright (c) 2023-∞ blurryroots innovation qanat OÜ
count-lines-of-code-package () {
# Counts only source files in main package.
local files=$(find ./src/piper_whistle -iname "*.py" -type f)
local count=$(for f in ${files}; do wc -l $f; done \
| awk '{ print $1 }' \
| awk '{s+=$1} END {printf "%.0f", s}')
@BlurryRoots
BlurryRoots / git-custom-exterminate.sh
Created December 30, 2023 16:56
Rewrite history and remove unwanted files. (Uses filter-branch, *heresy!*)
git-custom-exterminate () {
if [ "$1" = "" ]; then
echo "You have to specifiy the path of the file to destroy!"
exit
fi
echo "This will delete all references of $1!"
echo "Please back up your data, before running this command!"
echo "Continue?[y/n] > "
@BlurryRoots
BlurryRoots / qpaeq-ctl.sh
Last active October 30, 2023 22:29
qpaeq-ctl | Pulseaudio equalizer (qpaeq) utility command
#!/bin/bash
qpaeq-ctl () {
# Utility script to manage alsa equalizer 'qpaeq' (e.g. deb pulseaudio-equalizer)
# More info about 'qpaeq' at:
# https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Equalizer/
#
#
# Copyright (c) 2023 Sven Freiberg
#
@BlurryRoots
BlurryRoots / apply_macro_filter.py
Created October 18, 2023 14:41
Filter unreal macros when parsing with doxygen
#!/bin/python3
# Copyright (c) blurryroots innovation qanat OÜ
# Authored by Sven Freiberg
# Licensed under: MIT (https://opensource.org/license/mit/)
# Thanks to Paul Golds for the work inspiring this at
# https://github.com/normalvector/ue4_doxygen_source_filter
# Restructed, added fail state when files is not utf8 and option to configure
# which macros should be ignored.
@BlurryRoots
BlurryRoots / Recipe.h
Created May 27, 2022 19:14
List of enum mappings for unreal engine.
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Recipe.generated.h"
@BlurryRoots
BlurryRoots / wezterm.lua
Last active March 8, 2021 21:32
wezterm fix for { and } on macos
local wezterm = require 'wezterm';
return {
send_composed_key_when_left_alt_is_pressed=true,
send_composed_key_when_right_alt_is_pressed=false,
keys = {
{key="8", mods="ALT", action=wezterm.action{SendString="{"}},
{key="9", mods="ALT", action=wezterm.action{SendString="}"}}
}
}
struct NativeDataContainer {
void* RawData;
DWORD Size;
bool IsValid() const {
return nullptr != RawData;
}
NativeDataContainer()
: NativeDataContainer(0)
#define NATIVE_DESCRIPTIONT_MAX_LENGTH 42
typedef struct _NATIVE_DESCRIPTION {
ULONG uLength;
UCHAR ucDescription[NATIVE_DESCRIPTIONT_MAX_LENGTH];
} NATIVE_DESCRIPTION, *PNATIVE_DESCRIPTION;
typedef enum _NATIVE_OPERATION_CODE {
native_query_is_valid,
native_query_description
NativeQuery<NATIVE_OPERATION_CODE::native_query_is_valid> Query;
DWORD QueryState = Query.Execute(Handle);
if (Query.HasValidResult()) {
printf("Is valid query: %s\n", (*Query.GetResult() ? "true" : "false"));
}
else {
printf("Is valid query failed! (%d) DataSize: %d\n", QueryState, Query.GetDataSize());
}
/// Create NativeQuery template class implementations
DEFINE_QUERY_TYPE(native_query_is_valid, BOOL);
DEFINE_QUERY_TYPE(native_query_description, NATIVE_DESCRIPTION);
///