Skip to content

Instantly share code, notes, and snippets.

@luluco250
luluco250 / MouseRaw.cpp
Last active April 16, 2024 08:51
Getting raw mouse input with the native Windows API
/*
Example of how to get raw mouse input data using the native Windows API
through a "message-only" window that outputs to an allocated console window.
Not prepared for Unicode.
I don't recommend copy/pasting this, understand it before integrating it.
*/
// Make Windows.h slightly less of a headache.
#define NOMINMAX
@luluco250
luluco250 / search_cppreference.js
Last active December 8, 2017 04:47
Bookmarklet to search cppreference via a browser bookmark, just copy and paste it onto a new bookmark.
javascript: (function() {
const search_text = prompt("Search cppreference");
if (search_text !== null)
window.location.href =
"http://en.cppreference.com/mwiki/index.php?title=Special%3ASearch&search="
+ search_text;
}());
@luluco250
luluco250 / UDL_ReShadeFX.xml
Last active February 20, 2018 13:25
Notepad++ UDL Preset for the ReShadeFX shading language
<NotepadPlus>
<UserLang name="ReShade FX" ext="fx fxh" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00// 01\ 02 03/* 04*/</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2">0x</Keywords>
@luluco250
luluco250 / wx_mouseraw.cpp
Last active October 26, 2023 17:24
Win32 Mouse Raw Input using wxWidgets for output
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#define NOMINMAX
#define WIN32_LEAN_AND_MEAN
#define VC_EXTRALEAN
#include <Windows.h>
@luluco250
luluco250 / stopwatch.hpp
Created June 5, 2018 21:19
C++ Stopwatch
#ifndef STOPWATCH_HPP
#define STOPWATCH_HPP
#include <chrono>
namespace detail {
using namespace std::chrono;
using hrc = high_resolution_clock;
@luluco250
luluco250 / NoiseGen.shader
Created July 30, 2018 15:55
Screen noise generator shader written in Unity's ShaderLab
Shader "Hidden/Noise" {
Properties {
_Complexity("", Float) = 1.0
_TimeScale("", Float) = 0.0
}
SubShader { Cull Off ZWrite Off ZTest Always
CGINCLUDE
#include "UnityCG.cginc"
//========//
@luluco250
luluco250 / nodroptext.py
Last active May 23, 2021 20:46
Remove the "You can drop dockable dialogs here" text from GIMP
#!/usr/bin/env python3
VERSION = "1.0.3"
TARGET_TEXT = b"You can drop dockable dialogs here"
HELP_TEXT = (
"""Description:
This script replaces the "You can drop dockable dialogs here" text in GIMP with an empty one, disabling it.
Usage: nodroptext [<file_path>] [...]
@luluco250
luluco250 / format-decimals.js
Created December 4, 2018 14:13
Function for formatting decimal numbers, including specifying decimal places and optionally applying localization.
/*
Function for formatting decimal numbers,
including specifying decimal places and
optionally applying localization.
Parameters:
n: (Number | String)
Number to be formatted.
decimals: (Number)
@luluco250
luluco250 / AddKeyComponents.cs
Created December 23, 2018 22:40
Adding persistent events in Unity
#if UNITY_EDITOR
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using UnityEditor;
using UnityEditor.Events;
public class AddKeyComponents : MonoBehaviour {
public GameObject virtualKeyboard;
@luluco250
luluco250 / CPF.cs
Last active January 3, 2019 21:16
Brazilian ID Document (CPF) Data Type for C#
using System;
using System.Text.RegularExpressions;
public struct CPF {
public static readonly Regex FormatRegex = new Regex(
@"(\d\d\d)\.(\d\d\d)\.(\d\d\d)-(\d\d)",
RegexOptions.Compiled
);
public const int DigitCount = 11;