Skip to content

Instantly share code, notes, and snippets.

@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
@vurtun
vurtun / lay.c
Last active December 15, 2021 22:37
// gui_lay_row(ctx, 3, (int[]) { 30, -90, -1 }, 0);
/* Layout */
enum gui_lay_dir {
GUI_ROW,
GUI_COL,
};
struct gui_lay_sol {
int fix_siz;
int fix_cnt;
@vimtaai
vimtaai / markdown-flavors.md
Last active May 2, 2024 13:18
Comparison of features in various Markdown flavors

Comparison of syntax extensions in Markdown flavors

I created a crude comparison of the syntax of the various common Markdown extensions to have a better view on what are the most common extensions and what is the most widely accepted syntax for them. The list of Markdown flavors that I looked at was based on the list found on CommonMark's GitHub Wiki.

Flavor Superscript Subscript Deletion*
Strikethrough
Insertion* Highlight* Footnote Task list Table Abbr Deflist Smart typo TOC Math Math Block Mermaid
GFM
@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;

Graphical User Interfaces

Last time I wrote a little bit about my current GUI research progress. There are some things that were misunderstood so I want to clarify some fundamental design decisions and finally write up some current problems and their solutions.

First up I want to clarify a component is not another term for what is usually refered to as widget. Instead wigets in this implementation are made out of n >= 1 components. Components themself are just rectangles with attributes left, right, top, bottom, center_x, center_y, width and height some behavior flags and an optional surface to draw into. For example a scroll regions is made up out of at least three

@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
@vurtun
vurtun / gui.md
Last active October 4, 2023 15:44

Graphical User Interfaces

For the last few weeks I spend some time coding, writing and cleaning up my notes from almost a year since I published nuklear.

Basically this is a possible implementation for a graphical user interface builder backend with support for an immediate mode style API. So it provides a way to define non-mutating UI state, an immediate mode style API for dynamic UI components (lists,trees,...) and a combination of both.

The core implementation is ~800 LOC without any kind of default widgets or extensions. At first this seems quite counter intuitive. However since the inherent design allows for lots of different ways to define any widget like buttons it does not make sense to provide a specific default implementation. The way this code was architectured furthermore removes the need for style/skinning configurations used in Nuklear since widget painting is just calling a small

@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.
; ----------------------------------------------------------------------------------------------------------------------
@qwerty12
qwerty12 / LogonDesktop.ahk
Last active February 13, 2024 19:48
Bunch of functions to help facilitate running AutoHotkey on the Winlogon desktop - https://autohotkey.com/boards/viewtopic.php?f=6&t=27709
; LogonDesktop - run scripts on the Winlogon desktop
; 26/02/17 - qwerty12
; Modified version of RunAsTask() by SKAN: https://autohotkey.com/boards/viewtopic.php?t=4334
LogonDesktop_AddTask(runNow, runOnStartup)
{
local TaskName, XML, TaskSchd, TaskRoot, RunAsTask
local TASK_CREATE := 0x2, TASK_LOGON_SERVICE_ACCOUNT := 5, scriptDir := A_ScriptDir
try
@qwerty12
qwerty12 / AHKLogonMediaKeys.ahk
Last active December 3, 2021 01:30
Sample script for LogonDesktop. Enables media keys on the lockscreen
#NoTrayIcon
#Persistent
#NoEnv
#Include *i %A_ScriptDir%\Lib\FastDefaults.ahk
SetKeyDelay, -1, -1
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance Off ; This same script is launched multiple times
#UseHook Off ; Remove if you need complex hotkeys. WM_HOTKEY suits me fine; I don't want a low-level keyboard/mouse hook installed on WinSta0\Winlogon
#Include %A_ScriptDir%\Lib\LogonDesktop.ahk ; Naturally, this one is needed