Skip to content

Instantly share code, notes, and snippets.

@Flygsand
Flygsand / Undo-WinRMConfig.ps1
Created March 11, 2024 23:27
Undo-WinRMConfig.ps1
<#
.SYNOPSIS
Revert WinRM to a pristine state.
See this post for full details on why this code is helpful: https://cloudywindows.io/winrm-for-provisioning---close-the-door-on-the-way-out-eh/
.DESCRIPTION
CloudyWindows.io DevOps Automation: https://github.com/DarwinJS/CloudyWindowsAutomationCode
Why and How Blog Post: https://cloudywindows.io/winrm-for-provisioning---close-the-door-when-you-are-done-eh/
Invoke-Expression (Invoke-WebRequest -UseBasicParsing -Uri 'https://raw.githubusercontent.com/DarwinJS/Undo-WinRMConfig/blob/master/Undo-WinRMConfig/Undo-WinRMConfig.ps1')
Invoke-WebRequest -UseBasicParsing -Uri 'https://raw.githubusercontent.com/DarwinJS/Undo-WinRMConfig/blob/master/Undo-WinRMConfig/Undo-WinRMConfig.ps1' -outfile $env:public\Undo-WinRMConfig.ps1 ; & $env:public\Undo-WinRMConfig.ps1 -immediately
Contributing New Undo Profiles: https://github.com/DarwinJS/Undo-WinRMConfig/blob/master/readme.md
Add-Type @'
using System;
using System.Collections.Generic;
using System.Text;
namespace LSA
{
using System.Runtime.InteropServices;
using System.Security;
using System.Management;
@Flygsand
Flygsand / tinfoil.json
Last active July 21, 2023 10:36
Tinfoil index for Caddy
{{- $directories := list -}}
{{- $files := list -}}
{{- range .Items -}}
{{- if .IsDir -}}
{{- $directories = mustAppend $directories . -}}
{{- else -}}
{{- $files = mustAppend $files . -}}
{{- end -}}
{{- end -}}
{
@Flygsand
Flygsand / apache.html
Last active July 21, 2023 11:44
Apache-style index for Caddy
{{- define "icon" -}}
{{- if .IsDir -}}
<img src="data:image/gif;base64,R0lGODlhFAAWAMIAAP/////Mmcz//5lmMzMzMwAAAAAAAAAAACH+TlRoaXMgYXJ0IGlzIGluIHRoZSBwdWJsaWMgZG9tYWluLiBLZXZpbiBIdWdoZXMsIGtldmluaEBlaXQuY29tLCBTZXB0ZW1iZXIgMTk5NQAh+QQBAAACACwAAAAAFAAWAAADVCi63P4wyklZufjOErrvRcR9ZKYpxUB6aokGQyzHKxyO9RoTV54PPJyPBewNSUXhcWc8soJOIjTaSVJhVphWxd3CeILUbDwmgMPmtHrNIyxM8Iw7AQA7" alt="[DIR]">
{{- else if or (hasSuffix ".jpg" .Name) (hasSuffix ".jpeg" .Name) (hasSuffix ".png" .Name) (hasSuffix ".gif" .Name) (hasSuffix ".webp" .Name) (hasSuffix ".tiff" .Name) (hasSuffix ".bmp" .Name) (hasSuffix ".heif" .Name) (hasSuffix ".heic" .Name) -}}
<img src="data:image/gif;base64,R0lGODlhFAAWAOMAAP////8zM8z//8zMzJmZmWZmZmYAADMzMwCZzACZMwAzZgAAAAAAAAAAAAAAAAAAACH+TlRoaXMgYXJ0IGlzIGluIHRoZSBwdWJsaWMgZG9tYWluLiBLZXZpbiBIdWdoZXMsIGtldmluaEBlaXQuY29tLCBTZXB0ZW1iZXIgMTk5NQAh+QQBAAACACwAAAAAFAAWAAAEkPDISae4WBzAu99Hdm1eSYYZWXYqOgJBLAcDoNrYNssGsBy/4GsX6y2OyMWQ2OMQngSlBjZLWBM1AFSqkyU4A2tWywUMYt/wlTSIvgYGA/Zq3QwU7mmHvh4g8GUsfAUHCH95
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
int digitalroot(long num) {
int sum = 0;
// sum digits of num
@Flygsand
Flygsand / inib2json.py
Created September 28, 2022 18:30
INIB > JSON
import sys
import struct
import json
KEYS = {
-2129310917: '0x81154B3B',
-2117554806: 'godray_inival',
-2117455812: 'skyToneAmbientIntensity',
-2111807076: 'tmaaSharpness_1',
-2105411348: 'avmp10',
package example;
import java.util.function.Supplier;
import org.springframework.security.authorization.AuthorizationDecision;
import org.springframework.security.authorization.AuthorizationManager;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.access.intercept.RequestAuthorizationContext;
import org.springframework.stereotype.Component;
@Component
package example;
import org.springframework.security.oauth2.core.OAuth2TokenType;
import org.springframework.security.oauth2.server.authorization.JwtEncodingContext;
import org.springframework.security.oauth2.server.authorization.OAuth2TokenCustomizer;
import org.springframework.stereotype.Component;
@Component
public class JwtCustomizer implements OAuth2TokenCustomizer<JwtEncodingContext> {
@Flygsand
Flygsand / ipmi-updater.py
Created December 22, 2021 19:52 — forked from mcdamo/ipmi-updater.py
Supermicro IPMI certificate updater
#!/usr/bin/env python3
# vim: autoindent tabstop=4 shiftwidth=4 expandtab softtabstop=4 filetype=python
# This file is part of Supermicro IPMI certificate updater.
# Supermicro IPMI certificate updater is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
function FindProxyForURL(url, host) {
if (
dnsDomainIs(host, ".sap") ||
dnsDomainIs(host, ".sap.corp") ||
dnsDomainIs(host, ".sap.ondemand.com")) {
return "SOCKS5 127.0.0.1:10001";
}
return "DIRECT";
}