Skip to content

Instantly share code, notes, and snippets.

View jasikpark's full-sized avatar
🏳️‍🌈
happy pride month

Caleb Jasik jasikpark

🏳️‍🌈
happy pride month
View GitHub Profile
import type { Meta, StoryObj } from "@storybook/react";
import { expect, userEvent, waitFor, within } from "@storybook/test";
import fc from "fast-check";
import { useState } from "react";
import { SMORGASBORD_OPTIONS } from "./contants";
import { OptionSelector } from "./OptionSelector";
const meta = {
title: "components/OptionSelector",
component: OptionSelector,

Upgrading your IPv4 Cert V1 network to an IPv4/IPv6 Cert V2 network

Upgrade to nebula nightly

First of all, download the updated nebula version that has v2 certs and IPv6 support from nightly releases, and move all of the hosts in your network to it.

https://hub.docker.com/r/nebulaoss/nebula-nightly

@jasikpark
jasikpark / ipv6-quick-start.md
Created March 17, 2025 18:57
Seting up an IPv6 nebula network

Building an IPv6 network with the nebula nightly builds:

nebula-cert ca -name "Nebula IPv6 Tutorial CA" -encrypt
Enter passphrase:
# typed in my password and pressed enter.
@jasikpark
jasikpark / prefetch.ts
Created January 17, 2024 17:57
`usePrefetchQuery` with types
import { useQueryClient, type DefaultError, type FetchQueryOptions, type QueryKey } from '@tanstack/react-query';
// Type specified by `ensureQueryData` definition.
// Pulled from <https://tanstack.com/query/latest/docs/react/guides/prefetching>
export function usePrefetchQuery<
TQueryFnData,
TError = DefaultError,
TData = TQueryFnData,
TQueryKey extends QueryKey = QueryKey,
>(options: FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>, { enabled = false }: { enabled?: boolean } = {}) {
@jasikpark
jasikpark / are-we-formatting-yet.md
Created December 8, 2023 17:36
WIP list of all possible formatters w/ support for different languages
  • Rust
    • rustfmt
  • Go
    • gofmt
  • Javascript/Typescript
    • prettier
    • biome
  • Markdown
    • prettier
  • Python
@jasikpark
jasikpark / flake.nix
Created July 29, 2023 20:45
use an old hugo version via nix flakes
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
old-hugo-nixpkgs.url = "github:NixOS/nixpkgs/4fe31ab170bbbdd089b05b268b681542886eb642";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, old-hugo-nixpkgs, flake-utils, }:
flake-utils.lib.eachDefaultSystem
(system:
let
@jasikpark
jasikpark / Tab.tsx
Created April 25, 2023 18:53
Example of a polymorphic ariakit Tab component that can be a button or link
import { Tab as AriakitTab, type TabProps } from 'ariakit/tab';
import cn from 'classnames';
import { useLayoutEffect, useRef } from 'react';
import { useRect } from '@hooks/useRect';
import { useAnimatedTabs } from '../context/useAnimatedTabs';
import styles from './Tab.module.css';
/**
* A tab that goes at the top of a tab panel, which a user clicks on to change the UI underneath.
* This is a button by default, but can also be a react-router Link, if the `to` and `as` props are provided.
@jasikpark
jasikpark / posts%slash%[slug].astro
Created March 24, 2023 18:35
Imagined example of an SSR endpoint that returns the markdown sent in the request rendered in an Astro page shell as html
---
import { Markdown } from 'astro-remote';
import MainLayout from "@layouts/MainLayout.astro";
const markdown = Astro.request.headers.get('markdown');
---
<html>
<MainLayout>
<h1>My ODB post page</h1
<!-- Disallow inline `style` attributes, but allow HTML comments -->
<Markdown content={markdown} sanitize={{ dropAttributes: { "style": ["*"] }, allowComments: true }} />
@jasikpark
jasikpark / bleck
Last active January 26, 2023 18:04
openapi: 3.1.0
servers:
- url: https://api.defined.net
description: Default server
info:
description: |
# Introduction
This API is documented in **OpenAPI format** and describes methods that can be invoked when using an api key from <https://admin.defined.net/settings/api-keys>
Each endpoint is versioned individually, under a `/vXX` endpoint, ex `/v1/hosts` would become `/v2/hosts` with a breaking change, while `/v1/host-and-enrollment-code` would remain at `/v1`
@jasikpark
jasikpark / getBgHero.ts
Created December 14, 2022 19:31
Tool to generate a responsive `background-image: url("bg-hero.jpg");` for https://defined.net homepage
import { getPicture } from "@astrojs/image";
type BgHeroCSS = {
/** perfect for use w/ define:vars to inject */
cssProperty: string;
/** the source of the regular image */
imageSrc: string;
/** the sourceset used in the image-set */
imageSet: string;
/** the set useful for preloading