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
@jdhitsolutions
jdhitsolutions / demo.ps1
Created April 4, 2024 13:35
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 February 28, 2024 09:56
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.
@Workingdaturah
Workingdaturah / Invoke-GhostTask.ps1
Last active March 15, 2024 22:16
A PS1 Script intended to edit Scheduled Tasks via Registry Keys
function Invoke-GhostTask {
param (
[string]$TaskName,
[switch]$ShowTasks,
[string]$Id,
[string]$TargetTask,
[string]$TargetBinary,
[string]$Date,
[string]$Help
)
@tdmalone
tdmalone / aws-services.py
Created December 28, 2023 04:39
Using an undocumented (and thus subject-to-change) API, provides a list of all AWS services colourised as to whether or not they're available in the given region. Alternatively, given two regions, colourised based on whether services are available in one region, both regions, or neither of them.
#!/usr/bin/env python
import json, sys
from urllib.request import urlopen
def green(str): return f'\033[92m{str}\033[0m'
def orange(str): return f'\033[38;5;214m{str}\033[0m'
def red(str): return f'\033[91m{str}\033[0m'
def yellow(str): return f'\033[93m{str}\033[0m'
@gabriel-samfira
gabriel-samfira / setup_buildkit_on_windows.md
Created August 31, 2023 13:15
Install Buildkitd on Windows

Installing buildkit on Windows from source

This will set up buildkitd natively on Windows Server 2019 (ltsc2019) or Windows Server 2022 (ltsc2022).

Enable the containers feature

This will reboot your server if the feature is not already installed.

Install-WindowsFeature -Name containers -Restart
@rednafi
rednafi / main.go
Last active September 26, 2023 17:34
Dummy load balancer in a single Go script. Here's the full explanation: https://rednafi.com/go/dummy_load_balancer
/*
cc Redowan Delowar (rednafi.com)
+----------------------------------------+
| Load Balancer (8080) |
| +----------------------------------+ |
| | | |
| | Request from Client | |
| | | |
| +-----------------|----------------+ |