Skip to content

Instantly share code, notes, and snippets.

@jimbrig
jimbrig / openapi.yml
Created November 7, 2024 23:35
NoClocksAuth OpenAPI
openapi: 3.1.0
info:
title: No Clocks Auth API
version: 1.0.0
description: >-
This API allows for user authentication, management of users, roles, permissions, and session handling.
termsOfService: https://noclocks.dev/terms
contact:
name: API Support
url: https://support.noclocks.dev
@jimbrig
jimbrig / PasswordHashingExample.ps1
Created November 7, 2024 23:28 — forked from zola-25/PasswordHashingExample.ps1
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) {
@jimbrig
jimbrig / plumber_asynchronous.R
Created November 4, 2024 19:19 — forked from zola-25/plumber_asynchronous.R
Asynchronous REST Operations in R Plumber with futures
# plumber_asynchronous.R
require(future)
require(uuid)
plan(multiprocess)
defaultPackages <- c("plyr",
"dplyr",
"dbplyr",
@jimbrig
jimbrig / openapi.json
Last active November 7, 2024 23:04
Brandfetch OpenAPI
{
"openapi": "3.1.0",
"info": {
"title": "BrandFetch API",
"description": "API for retrieving brand information using domain or ID.",
"version": "1.0.0",
"termsOfService": "https://brandfetch.com/terms",
"license": {
"name": "MIT",
"url": "https://choosealicense.com/licenses/mit/"
@jimbrig
jimbrig / openapi.yml
Last active October 31, 2024 03:31
Brandfetch API Spec
openapi: 3.1.0
info:
title: Brandfetch API
description: Brandfetch API for retrieving brand information.
version: 2.0.0
termsOfService: https://brandfetch.com/terms
contact:
url: https://brandfetch.com/developers
servers:
- url: https://api.brandfetch.io/v2
@jimbrig
jimbrig / openrouter.R
Last active October 21, 2024 22:34
openrouter.R
library(httr2)
call_openrouter <- function(prompt, model = "openai/gpt-3.5-turbo") {
req <- request("https://openrouter.ai/api/v1/chat/completions") %>%
req_headers(
"Content-Type" = "application/json",
"Authorization" = paste("Bearer", Sys.getenv("OPENROUTER_API_KEY")),
"HTTP-Referer" = "https://your-site-url.com", # Optional
"X-Title" = "Your Site Name" # Optional
) %>%
@jimbrig
jimbrig / README.md
Created October 9, 2024 15:21
Docker Logins (Docker Hub, GitHub, GCP, Azure, AWS)
@jimbrig
jimbrig / openapi.yml
Created October 8, 2024 01:19
OpenAPI Security Scheme Examples
components:
securitySchemes:
# apiKey ------------
auth1:
description: Recommended authenticator
type: apiKey
in: query
name: key
auth2:
@jimbrig
jimbrig / titleUrlMarkdownClip.js
Created September 27, 2024 01:40 — forked from bradleybossard/titleUrlMarkdownClip.js
Bookmarklet to copy current page title and url in Markdown format to clipboard, like [title](url) - Usual for posting links to resources in README.md files
javascript:(function() {
function copyToClipboard(text) {
if (window.clipboardData && window.clipboardData.setData) {
/*IE specific code path to prevent textarea being shown while dialog is visible.*/
return clipboardData.setData("Text", text);
} else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
var textarea = document.createElement("textarea");
textarea.textContent = text;
@jimbrig
jimbrig / gist:eaf97bac73e9056c55d12a9023df2a4c
Created September 27, 2024 01:38 — forked from asabaylus/gist:3071099
Github Markdown Heading Anchors

Anchors in Markdown

To create an anchor to a heading in github flavored markdown. Add - characters between each word in the heading and wrap the value in parens (#some-markdown-heading) so your link should look like so:

[create an anchor](#anchors-in-markdown)