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
@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 | |
| | | |
| +-----------------|----------------+ |

Organizations who cannot take advantage of these protections can set the FEATURE_BLOCK_CROSS_PROTOCOL_FILE_NAVIGATION registry key to avoid exploitation. Please note that while these registry settings would mitigate exploitation of this issue, it could affect regular functionality for certain use cases related to these applications.

MS Documentation for the referenced registry settings:

$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BLOCK_CROSS_PROTOCOL_FILE_NAVIGATION"
$applications = @("Excel.exe", "Graph.exe", "MSAccess.exe", "MSPub.exe", "PowerPnt.exe", "Visio.exe", "WinProj.exe", "WinWord.exe", "Wordpad.exe")
@benkehoe
benkehoe / string_template_demo.py
Last active June 23, 2023 21:17
Demo of the two new methods of string.Template in Python 3.11
#!/usr/bin/env python3.11
# MIT No Attribution
#
# Copyright 2023 Ben Kehoe
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify,
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
@DHowett
DHowett / Program.cs
Created May 24, 2023 17:09
IWebAccount2 - C#/WinRT
using Windows.Security.Credentials;
using WinRT;
namespace CredentialCsWinRtTest {
internal class Program {
static void Main(string[] args) {
Windows.Security.Credentials.WebAccount foo = null /* or somehow get it */;
Windows.Security.Credentials.IWebAccount2 webAccount2 = foo.As<IWebAccount2>();
// if webaccount2 is not null . . .
webAccount2.SignOutAsync("clientId"); // do something with the async task actually
@Julynx
Julynx / 15_python_tips.md
Last active April 4, 2024 06:20
15 Python Tips To Take Your Code To The Next Level!
@edofic
edofic / index.html
Created May 6, 2023 19:06
htmx with a "backend" in service worker
<!DOCTYPE html>
<html>
<head>
<title>Hello Page</title>
<script src="https://unpkg.com/htmx.org@1.9.2"></script>
</head>
<body>
<h1>Hello</h1>
@kconner
kconner / macOS Internals.md
Last active May 17, 2024 06:10
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@candlerb
candlerb / go-project-layout.md
Last active April 24, 2024 19:22
Suggestions for go project layout

If someone asked me the question "what layout should I use for my Go code repository?", I'd start by asking back "what are you building: an executable, or a library?"

Single executable

Stage 1: single source file

Create a directory named however you want your final executable to be called (e.g. "mycommand"), change into that directory, and create the following files:

@dtaivpp
dtaivpp / logging_demo.py
Last active December 3, 2023 14:42
An introduction to logging in Python!
# Download this file with:
# curl -L https://gist.githubusercontent.com/dtaivpp/a9b00957aa7d9cfe33e92aff8d50c835/raw/logging_demo.py -o logging_demo.py
import logging
#
# Named loggers
#
logger = logging.getLogger(__name__)
print(logger.name)