Skip to content

Instantly share code, notes, and snippets.

View christian-korneck's full-sized avatar
💭
I may be slow to respond.

Christian Korneck christian-korneck

💭
I may be slow to respond.
View GitHub Profile
function Write-CustomLog {
param([string]$Message)
$callerInfo = (Get-PSCallStack)[1]
$scriptName = Split-Path -Leaf $callerInfo.ScriptName
$lineNumber = $callerInfo.ScriptLineNumber
$functionName = $callerInfo.FunctionName
$logEntry = "{0:yyyy-MM-dd HH:mm:ss} - {1}:{2} - {3} - {4}" -f `
(Get-Date), $scriptName, $lineNumber, $functionName, $Message
@allyford
allyford / README.md
Last active July 5, 2024 16:14
Enable Windows Exporter on AKS (Preview)

Enable Windows Exporter on AKS (Private Preview)

AKS preview features are available on a self-service, opt-in basis. Previews are provided "as is" and "as available," and they're excluded from the service-level agreements and limited warranty. AKS previews are partially covered by customer support on a best-effort basis. As such, these features aren't meant for production use. For more information, see the following support articles:

AKS support policies

Azure support FAQ

What is Windows Exporter?

@boxabirds
boxabirds / main.go
Created May 21, 2024 12:00
Demo of how to create a summariser using golang and Anthropic Claude.
package main
import (
"context"
"flag"
"fmt"
"io"
"log"
"os"
"time"
param(
[parameter(Mandatory)]
$user,
[System.Management.Automation.SwitchParameter]
$delete,
[string]
$yourUsername,
@jdhitsolutions
jdhitsolutions / demo.ps1
Last active May 29, 2024 13:37
Material from my RTPSUG presentation on writing better PowerShell code
return "This is a demo script file."
# Find Me: https://jdhitsolutions.github.io
# Any one can learn syntax and mechanics.
# Let's focus on the squishy bits - what you should write
# and what not to write
#region Essential rules
#!/usr/bin/env python3
import usb.core
import struct
from collections import namedtuple
APPLE_VID = 0x05ac
Target = namedtuple("Target", ["vid", "pid", "name", "model", "total_size"])
@awakecoding
awakecoding / Set-ZipFileUnixPermissions.ps1
Created March 12, 2024 18:25
Set zip file unix permissions (useful to set execute bit on executables without using chmod +x)
#!/usr/bin/env pwsh
param(
[Parameter(Position = 0, Mandatory = $true)]
[string] $ZipFilePath,
[Parameter(Position = 1, Mandatory = $true)]
[string] $FilePattern,
[Parameter(Position = 2, Mandatory = $true)]
@smeijer
smeijer / github-sync.sh
Created February 6, 2024 17:43
sync github repositories
#! /usr/bin/env node
import fs from 'fs';
import { promisify } from 'util';
import path from 'path';
import { spawn } from 'child_process';
const fsExists = promisify(fs.exists);
if (!process.env.GITHUB_TOKEN) throw new Error("process.env.GITHUB_TOKEN is required");
if (!process.env.GITHUB_USER) throw new Error("process.env.GITHUB_USER is required");
@jborean93
jborean93 / Test-Tls.ps1
Last active May 20, 2024 19:28
Tests the TLS connection by doing a client hello with the hostname specified
# Copyright: (c) 2024, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function Test-Tls {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string]
$HostName,
@sebastiancarlos
sebastiancarlos / minimal_dir.py
Last active January 20, 2024 10:08
Like dir(), but filters out __*__ attributes, standard library packages, and built-ins, to give a better idea of the object's custom attributes.
# explicitly define the interface
__all__ = ["minimal_dir"]
from functools import cache
@cache
def get_stdlib_packages():
""" Get list that should include all stdlib package/module names.
Not perfect. Has false positives.