Skip to content

Instantly share code, notes, and snippets.

@zola-25
zola-25 / HomeController.cs
Last active November 7, 2024 23:27
Maintaining User Session State with Cookies - Raw, Library-free Implementation with ASP.NET Core MVC
using System.Security.Cryptography;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace CookieSessionStateDemo.Controllers
{
public static class InMemoryDataStore
{
public static readonly Dictionary<string, string> UserSessions = new();
public static readonly Dictionary<string, string> UserCredentials = new() { { "user1", "password1" }, { "user2", "password2" } };
@zola-25
zola-25 / PasswordHashingExample.ps1
Created April 30, 2023 07:20
PowerShell example showing outputs generated for a simple SHA-256 hash. No salting or other security mechanisms included.
$inputString = "Password123"
$sha256 = [System.Security.Cryptography.SHA256]::Create()
$bytes = [System.Text.Encoding]::UTF8.GetBytes($inputString)
$hashBytes = $sha256.ComputeHash($bytes)
$base64String = [System.Convert]::ToBase64String($hashBytes)
$binaryString = [System.Text.StringBuilder]::new()
foreach ($byte in $hashBytes) {
---
title: Reading a YAML chunk
output: github_document
---
Here's a simple YAML chunk (with the label `config`):
```{yaml config}
default:
user: "garrick"
@denelon
denelon / List.md
Last active October 31, 2023 15:36
WinGet Configure Samples

Sample configuration.dsc.yaml files

These samples require the experimental configuration feature to be enabled. WinGet 1.5.863-preview or newer is required.

Add the following to your settings.json to enable this feature:

    "experimentalFeatures": {"dependencies": true, 
 "configuration": true
@DeepanshKhurana
DeepanshKhurana / app.R
Created March 25, 2023 08:43
Using Reactable with YAML
# Loading Libraries ----
library(reactable)
library(yaml)
library(shiny)
# Generate Reactable Function ----
generate_reactable <- function(data,
table_type,
@jimbrig
jimbrig / top-brew-packages.txt
Created March 24, 2023 23:42 — forked from pmkay/top-brew-packages.txt
Top homebrew packages
node: Platform built on V8 to build network applications
git: Distributed revision control system
wget: Internet file retriever
yarn: JavaScript package manager
python3: Interpreted, interactive, object-oriented programming language
coreutils: GNU File, Shell, and Text utilities
pkg-config: Manage compile and link flags for libraries
chromedriver: Tool for automated testing of webapps across many browsers
awscli: Official Amazon AWS command-line interface
automake: Tool for generating GNU Standards-compliant Makefiles
@DeepanshKhurana
DeepanshKhurana / reactable_edit.R
Last active February 11, 2025 15:01
Editable Reactable (with Modals)
library(shiny)
library(reactable)
library(dplyr)
ui <- fluidPage(
actionButton(inputId = "edit",
label = "Edit"),
reactableOutput("table")
)
@JustinGrote
JustinGrote / Get-ScriptModules.ps1
Last active August 19, 2024 19:17
Find the module names for all commands used in a script
#requires -version 7
using namespace System.Management.Automation.Language
using namespace Collections.Generic.Queue
function Get-ScriptModules {
<#
.SCRIPTBLOCK
Given a script, returns a list of all the modules it uses.
#>
@JustinGrote
JustinGrote / README.MD
Last active September 6, 2024 04:02
A proxy for Format-Table to apply the resultant view or save it as a format definition

TypeFormat

This module provides an improved Format-Table that lets you persist the resultant Format-Table view either to the current session or to a .ps1xml formatting file.

This module requires PowerShell 7.2+, however the generated XML format files can be used with earlier versions.

Quick Start

PS> Get-Date
// look at this glorious shit!! look what you can do with with!!
const someObject = {
foo: 'bar',
baz: 1,
asdf: ['quux'],
}
with (someObject) {
console.log(foo)