Skip to content

Instantly share code, notes, and snippets.

View iUltimateLP's full-sized avatar
🏠
Working from home

Johnny iUltimateLP

🏠
Working from home
View GitHub Profile
@iUltimateLP
iUltimateLP / stm32_platformio.ini
Created August 15, 2023 09:40
Kickstart example to get PlatformIO to work with a STM32CubeMX generated project.
; STM32 PlatformIO configuration file
;
; This is a kickstart example to get PlatformIO to work with a STM32CubeMX generated project, which eliminates the need of
; of the STM32CubeIDE. It also exclusively uses the driver files provided by CubeMX, rather than the outdated ones PlatformIO uses.
;
; The following steps get you started:
; 1. Open the STM32CubeMX tool, find your board/MCU, and create a new project.
; 2. Go to the "Project Manager" tab and set the following:
;
; Project > Toolchain / IDE : "Makefile"
@iUltimateLP
iUltimateLP / build_instagram_slides.bat
Last active April 13, 2023 12:20
Extracts a number of images sequentially aligned in a horizontal strip of slides into seperate files (e.g. for Instagram Slides). Requires FFMPEG!
@echo off
:: Check for arguments
IF [%1]==[] GOTO USAGE
IF [%2]==[] GOTO USAGE
IF [%3]==[] GOTO USAGE
:: Arguments
SET "input=%1"
SET "inputName=%~n1"
@iUltimateLP
iUltimateLP / GetP4Changelist.cs
Last active August 31, 2023 20:16
Example Unreal Engine 4/5 Build.cs script that automatically fetches the current Perforce changelist and embeds it into code
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
using System;
using UnrealBuildTool;
using System.Diagnostics;
public class BuildScriptUtils
{
// Runs p4.exe to determine the current changelist
// Returns true if it could determine the changelist, false if not
@iUltimateLP
iUltimateLP / vax_colors_for_resharper.DotSettings
Last active May 9, 2022 08:32
Visual Assist X color scheme for ReSharper. Import the .DotSettings file into ReSharper and the .vssettings file into Visual Studio.
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/Highlighting/IdentifierHighlightingEnabled/@EntryValue">True</s:Boolean></wpf:ResourceDictionary>
@iUltimateLP
iUltimateLP / gource_p4.sh
Created October 7, 2021 17:09
Gource Perforce Script
#!/bin/bash
# Put your P4 credentials here!
P4_IP="some.domain.com:1666"
P4_USER=John
P4_PASS=johndoe1234
rm -rf gource.log
p4 -p $P4_IP -u $P4_USER -P $P4_PASS changes |awk '{print $2}'|p4 -p $P4_IP -u $P4_USER -P $P4_PASS -x - describe -s|awk '(/^Change / || /^... /) {if ($1 == "Change") {u=substr($4,1,index($4,"@")-1); t = $(NF-1) " " $NF; gsub("/"," ",t); gsub(":"," ",t);time=mktime(t);} else {if ($NF=="add") {c="A";} else if ($NF=="delete") {c="D";} else {c="M";};f=substr($2,3,index($2,"#")-3);print time "|" u "|" c "|" f;}}'|sort -n > gource.log
@iUltimateLP
iUltimateLP / HeadBobComponent.cpp
Last active July 28, 2022 10:17
Adds a flexible Head Bobbing component to the Unreal Engine. Supports three different camera shake states (idle, walk, run).
// Copyright 2019-2021 Jonathan Verbeek. All Rights Reserved.
#include "Player/HeadBobComponent.h"
UHeadBobComponent::UHeadBobComponent()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;
@iUltimateLP
iUltimateLP / DynamicTexture.cpp
Last active February 13, 2024 12:58
Implements dynamic textures into Unreal Engine 4, which can be dynamically written at runtime using the fastest way possible: by directly manipulating the pixel buffer of the texture.
// DynamicTexture
#include "DynamicTexture.h"
// UTextures have a BPP of 4 (Red, Green, Blue, Alpha)
#define DYNAMIC_TEXTURE_BYTES_PER_PIXEL 4
void UDynamicTexture::Initialize(int32 InWidth, int32 InHeight, FLinearColor InClearColor, TextureFilter FilterMethod/* = TextureFilter::TF_Nearest*/)
{
// Store the parameters
@iUltimateLP
iUltimateLP / analog-clock.cc
Last active May 16, 2018 16:24
RGB LED Matrix + Raspberry Pi = Analog Clock
// -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
// Small example how to use the library.
// For more examples, look at demo-main.cc
//
// This code is public domain
// (but note, that the led-matrix library this depends on is GPL v2)
#include "led-matrix.h"
#include <unistd.h>
@iUltimateLP
iUltimateLP / steamsdk_lambda_callresults.h
Last active December 19, 2020 19:10
This adds a prototype for a custom CCallResult class which allows you to use lambdas instead of class member functions.
// This is a custom Steam CallResult to support C++ lambdas
//-----------------------------------------------------------------------------
// Purpose: maps a steam async call result to a lambda function
// template params: P = parameter struct
//-----------------------------------------------------------------------------
template<class P>
class CLambdaCallResult : private CCallbackBase
{
public:
typedef void (*func_t)(P*, bool);
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "localhost:8080/secure", true);
xmlhttp.setRequestHeader("Authorization", "Basic logout");
xmlhttp.send();