Skip to content

Instantly share code, notes, and snippets.

View SkyyySi's full-sized avatar

SkyyySi

View GitHub Profile
@SkyyySi
SkyyySi / Test-Printer.ps1
Last active March 27, 2025 11:07
A small PowerShell script to check if one or more shared printer(s) is known on a given printer server
# SPDX-License-Identifier: 0BSD
# Author: Simon Buschendorf (github.com/SkyyySi)
#
# To invoke this script, run it like this:
#
# powershell.exe -File '.\Test-Printer.ps1' -Name 'foo'
#
# Or, for multiple printers, like this:
#
# powershell.exe -Command "& '.\Test-Printer.ps1' -Name @('foo', 'bar')"
@SkyyySi
SkyyySi / benchmark.lua
Last active March 18, 2025 07:27
A quick performance test comparing closures and regular functions in Lua
local function benchmark(func, name, times, ...)
name = name or "<anonymous>"
times = times or 100000
io.write(name, " --> ")
io.flush()
local time_start = os.clock()
for i = 1, times do
local lfs = require("lfs")
local _M = {}
function _M.list_child_files(directory_path)
local function get_full_child_paths(child_name)
if (child_name == ".") or (child_name == "..") then
return {}
end

UI-less Firefox

This is a short guide on how to set up a Firefox profile with no UI (no tabs, no address-bar, no bookmarks, etc.). Note that it is written for and only tested on Arch Linux. You'll probably need to perform different steps on Windows.

  1. Create a new Firefox profile
    1. Run this shell command:

firefox --no-remote --profilemanager

#!/usr/bin/env lua
local type = type
local print = print
local pcall = pcall
local select = select
local string = string
local io = io
local string_format = string.format
@SkyyySi
SkyyySi / ihk-fixes.user.styl
Last active January 6, 2025 16:02
Ein UserCSS / UserStyle, um die Webseite der Niederrheinischen IHK zumindest ein bisschen weniger fürchterlich zu machen.
/* ==UserStyle==
@name IHK Azubiheft Fix
@namespace github.com/SkyyySi
@version 1.0.0
@description Ein UserCSS / UserStyle, um die Webseite der Niederrheinischen IHK zumindest ein bisschen weniger fürchterlich zu machen.
@author SkyyySi
@preprocessor stylus
==/UserStyle== */
$header_padding = 1em

Microsoft Management Console (mmc)

Syntax

For starting a Snap-In from CMD, stored in an arbitrary directoy:

C:\> "%windir%\System32\mmc.exe" "<path>\<filename>.msc"
local getmetatable = getmetatable
local type = type
local assert = assert
local rawget = rawget
---@class private
local _M = {}
--- A helper function to check whether the type of a given parameter is correct,
--- generating an error message if it is not.
@SkyyySi
SkyyySi / gtk.css
Created October 22, 2023 17:58
Dracula for GTK4 / libadwaita applications
/*
Generated with Gradience
Issues caused by theming should be reported to Gradience repository, and not to upstream
https://github.com/GradienceTeam/Gradience
*/
@define-color accent_color #bd93f9;
@define-color accent_bg_color #bd93f9;
@SkyyySi
SkyyySi / get-battery.lua
Last active October 18, 2023 16:43
A standalone script to get the current charging percentage of your device's battery, written in Lua. Requires LGI. Linux only (maybe BSD too; probably not, though).
#!/usr/bin/env luajit
local script_version = "1.1.1"
local lgi = require("lgi")
local GLib = lgi.GLib
local UPowerGlib = lgi.UPowerGlib
local function get_battery()
for _, device in pairs(UPowerGlib.Client():get_devices()) do