Skip to content

Instantly share code, notes, and snippets.

@qwerty12
qwerty12 / README.md
Last active April 16, 2024 16:12
pk.q12.defvidspeed - quick and dirty Kodi addon to set a default video speed
#NoEnv
#NoTrayIcon
AutoTrim Off
SetBatchLines, -1
ListLines, Off
#SingleInstance ignore
SetWorkingDir %A_ScriptDir%
/*
RegisterSyncCallback (by Lexikos)
//go:build windows
// +build windows
package main
import (
"unsafe"
"syscall"
"os/user"
// +build windows
/*
Parts derived from
https://github.com/hallazzang/go-windows-programming
https://github.com/GameXG/gowindows
https://stackoverflow.com/a/37911789
*/
package main
@qwerty12
qwerty12 / termux-url-opener
Last active July 7, 2023 07:40
Install the followig at least: VLC in Android, `jq`, Termux API, `youtube-dl`, `streamlink`, `gallery-dl` and `aria2c`
#!/data/data/com.termux/files/usr/bin/bash
if [ -z "${1:-}" ]; then
exit 1
fi
url_is_supported() {
REPLY=""
declare -A arr
case "$1" in
@qwerty12
qwerty12 / building_transmission_daemon_on_windows.md
Last active February 11, 2019 21:56
Building transmission-daemon on for Windows 64-bit

Building transmission-daemon on and for Windows 64-bit

This short guide is only possible because of the Transmission, OpenSSL, curl and CMake developers' work.
Thanks to https://github.com/transmission/transmission-release-scripts/blob/master/build-windows.ps1 and https://build.transmissionbt.com/job/trunk-win32/arch=x64,label=pepito-win10/lastSuccessfulBuild/consoleText for showing the way.

The Transmission Project itself already provides [https://transmissionbt.com/download/](official builds w/ installer) which I install myself to have, among other things, an entry in the Windows services database for transmission-daemon.

I build my own transmission-daemon for these excellent patches:

@qwerty12
qwerty12 / enable-all-advanced-power-settings.ps1
Last active November 2, 2021 09:07 — forked from raspi/enable-all-advanced-power-settings.ps1
Enable all advanced power settings in Windows.
# List all possible power config GUIDs in Windows
# Run: this-script.ps1 | Out-File powercfg.ps1
# Then edit and run powercfg.ps1
# (c) Pekka "raspi" Järvinen 2017
# https://stackoverflow.com/a/22156833
if (-not ([System.Management.Automation.PSTypeName]'PowrProf').Type)
{
Add-Type -TypeDefinition @"
using System;
@qwerty12
qwerty12 / StartVC.ahk
Last active February 13, 2024 19:48
Example of using LogonDesktop to find a suitable SYSTEM token to impersonate, allowing the start of a process from another session without creating a service
#NoTrayIcon
Process, Priority, , A
#Include <FastDefaults>
#SingleInstance Ignore
#Include <LogonDesktop>
CanWeWorkWithThisSystemToken(proc, ByRef hNonDuplicatedToken, wantedSystemTokenPrivs)
{
static cbTOKEN_PRIVILEGES := 16, TokenPrivileges := 3, SecurityImpersonation := 2, TokenImpersonation := 2
static TokenDesiredAccess := TOKEN_DUPLICATE := 0x0002 | TOKEN_IMPERSONATE := 0x0004 | TOKEN_QUERY := 0x0008 | TOKEN_ASSIGN_PRIMARY := 0x0001 | TOKEN_ADJUST_PRIVILEGES := 0x0020
SaveSetColours(set := False, liteSet := True)
{
; Sys colours saving adapted from an approach found in Bertrand Deo's code
; The rest is from Michael Maltsev: https://github.com/RaMMicHaeL/Windows-10-Color-Control
static DWMCOLORIZATIONPARAMS, IMMERSIVE_COLOR_PREFERENCE
,DwmGetColorizationParameters := DllCall("GetProcAddress", "Ptr", DllCall("GetModuleHandleW", "WStr", "dwmapi.dll", "Ptr"), "Ptr", 127, "Ptr")
,DwmSetColorizationParameters := DllCall("GetProcAddress", "Ptr", DllCall("GetModuleHandleW", "WStr", "dwmapi.dll", "Ptr"), "Ptr", 131, "Ptr")
,GetUserColorPreference := DllCall("GetProcAddress", "Ptr", DllCall("GetModuleHandleW", "WStr", "uxtheme.dll", "Ptr"), "AStr", "GetUserColorPreference", "Ptr")
,SetUserColorPreference := DllCall("GetProcAddress", "Ptr", DllCall("GetModuleHandleW", "WStr", "uxtheme.dll", "Ptr"), "Ptr", 122, "Ptr")
,WM_SYSCOLORCHANGE := 0x0015, sys_colours, sav_colours, colourCount := 31, GetSysColor := DllCall("GetProcAddress", "Ptr", DllCall("GetModule
@qwerty12
qwerty12 / TermWait.ahk
Last active November 2, 2021 09:07
Slightly modified version of cyruz' and SKAN's TermWait for LogonDesktop
; ----------------------------------------------------------------------------------------------------------------------
; Name .........: TermWait library
; Description ..: Implement the RegisterWaitForSingleObject Windows API.
; AHK Version ..: AHK_L 1.1.13.01 x32/64 Unicode
; Author .......: Cyruz (http://ciroprincipe.info) & SKAN (http://goo.gl/EpCq0Z)
; License ......: WTFPL - http://www.wtfpl.net/txt/copying/
; Changelog ....: Sep. 15, 2012 - v0.1 - First revision.
; ..............: Jan. 02, 2014 - v0.2 - AHK_L Unicode and x64 version.
; ----------------------------------------------------------------------------------------------------------------------