Skip to content

Instantly share code, notes, and snippets.

View JavierJF's full-sized avatar

Javier Jaramago Fernández JavierJF

  • ProxySQL
  • Sevilla, España
View GitHub Profile
@JavierJF
JavierJF / constexpr_string.cpp
Last active December 12, 2016 11:41 — forked from ericniebler/constexpr_string.cpp
An almost perfect design for a hybrid constexpr/runtime string
// Copyright Eric Niebler 2016
#include <cstddef>
#include <cstdio>
#include <cstdint>
#include <cstring>
#include <utility>
#include <type_traits>
#define REQUIRES(X) \
$setwallpapersrc = @"
using System.Runtime.InteropServices;
public class wallpaper
{
public const int SetDesktopWallpaper = 20;
public const int UpdateIniFile = 0x01;
public const int SendWinIniChange = 0x02;
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern int SystemParametersInfo (int uAction, int uParam, string lpvParam, int fuWinIni);
public static void SetWallpaper ( string path )
@JavierJF
JavierJF / screenbright.cpp
Last active September 27, 2017 15:09
Get current windows brightness in Windows (DDC/CI)
#include <Windows.h>
#include <PhysicalMonitorEnumerationAPI.h>
#include <HighLevelMonitorConfigurationAPI.h>
#include <iostream>
#include <cstdint>
#include <string>
// Returns the last Win32 error, in string format. Returns an empty string if there is no error.
std::string GetLastErrorAsString()
{
@JavierJF
JavierJF / wmi-brightness.cpp
Created September 28, 2017 16:57
WMI Client POC function for setting brightness
#include <objbase.h>
#include <windows.h>
#include <stdio.h>
#include <wbemidl.h>
#include <comdef.h>
#include <string>
#pragma comment(lib, "wbemuuid.lib")
#pragma comment(lib, "comsuppw.lib")
@JavierJF
JavierJF / TryIconSetter.cs
Last active March 20, 2018 18:09
Simple Solution to trigger TrayIcon through settings with UIA
/*
* App.cs
* Copyright 2018 Raising the Floor - International
*
* Licensed under the New BSD license. You may not use this file except in
* compliance with this License.
*
* The R&D leading to these results received funding from the
* Department of Education - Grant H421A150005 (GPII-APCP). However,
* these results do not necessarily represent the policy of the
@JavierJF
JavierJF / StartMenuLayout.cs
Last active March 20, 2018 18:21
Bug: Simple solution for setting the StartMenu layout using C# and PowerShell
/*!
* GPII Windows 10 Start Menu Layout Setter.
*
* Copyright 2018 Raising the Floor - International
*
* Licensed under the New BSD license. You may not use this file except in
* compliance with this License.
*
* The research leading to these results has received funding from the European Union's
* Seventh Framework Programme (FP7/2007-2013)
@JavierJF
JavierJF / StartMenuLayout.js
Last active March 20, 2018 18:17
Bug: Simple function to set the StartMenu layout using Node. Powershell, and edge-ps.
gpii.windows.startMenuLayout.exportLayout = function () {
var promise = fluid.promise();
var psScript = edge.func('ps', function () {
/*
$VerbosePreference = "continue"
$ErrorActionPreference = "Stop"
$GPII_Data_Path = Join-Path $env:LOCALAPPDATA "GPII"
$CurrentLayout = Join-Path $GPII_Data_Path "menuLayouts\current_layout.xml"
@JavierJF
JavierJF / ExportStartLayout.cs
Last active April 23, 2024 19:11
Setting StartMenu layout using C# - statically
/*!
* GPII Windows 10 Start Menu Layout Setter.
*
* Copyright 2018 Raising the Floor - International
*
* Licensed under the New BSD license. You may not use this file except in
* compliance with this License.
*
* The research leading to these results has received funding from the European Union's
* Seventh Framework Programme (FP7/2007-2013)
@JavierJF
JavierJF / StartMenuLayout.cs
Created March 20, 2018 18:52
Error: Setting StartMenu layout using C# - dynamically
/*!
* GPII Windows 10 Start Menu Layout Setter.
*
* Copyright 2018 Raising the Floor - International
*
* Licensed under the New BSD license. You may not use this file except in
* compliance with this License.
*
* The research leading to these results has received funding from the European Union's
* Seventh Framework Programme (FP7/2007-2013)
@JavierJF
JavierJF / VoiceProfileEnum.cpp
Created July 2, 2019 17:01
Windows SAPI voice profile properties enumeration
#include "pch.h"
#include <iostream>
#include <io.h>
#include <fcntl.h>
#include <Shlobj.h>
#include <string>
CComPtr<ISpObjectToken> createIspObjectToken() {