Skip to content

Instantly share code, notes, and snippets.

View winstxnhdw's full-sized avatar
⚠️
This user is a registered cybercriminal. Learn about GitHub Terms of Service.

Winston H. winstxnhdw

⚠️
This user is a registered cybercriminal. Learn about GitHub Terms of Service.
View GitHub Profile
@winstxnhdw
winstxnhdw / spam.sh
Last active January 29, 2024 09:33
A simple POSIX-compatible shell script to indefinitely execute short-lived functions with GNU Parallel and yes.
func() {
echo "Hello world!"
}
export -f func
yes '' | parallel -j 10 --delay 0auto func
@winstxnhdw
winstxnhdw / UnityNuGet.csproj
Created August 23, 2023 13:09
A .NET project file describing complex usage of MSBuild to extract binaries from gRPC.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PublishDir>../Assets/NuGet</PublishDir>
<TargetFramework>netstandard2.1</TargetFramework>
<UnityBuildArchitecture>win-x64</UnityBuildArchitecture>
<ProtobufClientDir>../Assets</ProtobufClientDir>
</PropertyGroup>
@winstxnhdw
winstxnhdw / sort3.py
Last active September 1, 2023 03:41
A generic typesafe in-place implementation of a sort3 algorithm in Python
from typing import Annotated, Callable, NamedTuple, Protocol, TypeVar
class MaxLength(NamedTuple):
"""
Summary
-------
a data structure for annotating the maximum length of a list
Attributes
@winstxnhdw
winstxnhdw / quicksort.py
Last active September 1, 2023 03:41
A generic typesafe stack-based iterative in-place implementation of the Median-of-Three Quicksort algorithm in Python.
from random import sample
from typing import Callable, Protocol, TypeVar
class Comparable(Protocol):
"""
Summary
-------
a protocol for comparable types
"""
@winstxnhdw
winstxnhdw / compose.yaml
Last active September 21, 2023 22:56
Docker Compose template for running Consul.NET's testing suite.
services:
consul:
container_name: consul
image: hashicorp/consul-enterprise:1.9.17-ent
network_mode: host
volumes: [./Consul.Test:/config:ro]
command: consul agent -dev -config-file config/test_config.json -log-level=error
healthcheck:
test: ['CMD-SHELL', 'curl localhost:8500/v1/status/leader']
interval: 1s
@winstxnhdw
winstxnhdw / tic_tac_toe.py
Last active July 25, 2023 00:06
An N-by-N tic-tac-toe game framework.
from enum import Enum
class Players(Enum):
"""
Summary
-------
an enum to represent the players
"""
NULL = 0
@winstxnhdw
winstxnhdw / get_endpoint.ts
Last active April 25, 2023 09:06
Helper script to retrieve endpoint(s) from a route with Playwright.
import type { Browser, BrowserContext, BrowserType, LaunchOptions, Page } from 'playwright'
import { chromium, firefox, webkit } from 'playwright'
type BrowserTypes = 'chromium' | 'webkit' | 'firefox'
type Endpoint = {
url: string
headers: Record<string, string>
}
@winstxnhdw
winstxnhdw / delete_workflows.sh
Created April 12, 2023 20:12
Shell script for removing specified GitHub workflows.
org=USER_NAME
repo=REPO_NAME
workflow_ids=(1 2 3)
for workflow_id in "${workflow_ids[@]}"
do
echo "Listing runs for the workflow ID $workflow_id"
run_ids=( $(gh api repos/$org/$repo/actions/workflows/$workflow_id/runs --paginate | jq '.workflow_runs[].id') )
for run_id in "${run_ids[@]}"
@winstxnhdw
winstxnhdw / Dockerfile
Created April 1, 2023 11:31
Dockerfile for building an interactive and stable R environment.
FROM ubuntu:rolling
ENV DEBIAN_FRONTEND noninteractive
RUN apt update
RUN apt upgrade
RUN apt install r-base -y
RUN apt install python3-pip -y
RUN pip install -U radian
RUN echo "alias r='radian'" >> ~/.bashrc
@winstxnhdw
winstxnhdw / server.py
Last active September 1, 2023 03:42
A simple HTTP server that prints the request headers and JSON body to the console.
from http.server import HTTPServer, SimpleHTTPRequestHandler
from json import dumps, loads
from sys import argv
from typing import Literal
class Server(SimpleHTTPRequestHandler):
"""
Summary
-------