Skip to content

Instantly share code, notes, and snippets.

View john-h-k's full-sized avatar

John Kelly john-h-k

View GitHub Profile
@john-h-k
john-h-k / altfile
Created July 4, 2025 09:31
altfile
#!/bin/zsh
find_other_file() {
local file="$1"
local dir
local base
local ext
local candidates=()
dir="${file:h}"
theme = "john_acario_dark"
[editor]
line-number = "relative"
mouse = true
scroll-lines = 1
cursorline = true
auto-save = false
completion-trigger-len = 1
true-color = true
[[language]]
name = "markdown"
soft-wrap.enable = true
# [language-server.zls]
# omit the following line if `zls` is in your PATH
# command = "/to/zls_executable"
# There are two ways to set config options:
# - edit your `zls.json` that applies to any editor that uses ZLS
# - set in-editor config options with the `config.<name>` fields below.
int sel(int a, int b, int c, int d, int e, int f) {
return a, b ? c, d : e, f;
}
int main() {
return sel(0, 1, 2, 3, 4, 5);
}
@john-h-k
john-h-k / ek.zsh
Last active January 29, 2025 08:24
Key manager
## !! Replace with whatever file you want keys in
EK_KEY_DIR="~/repos/eval-pk"
######### subcommand plugin #########
invoke-subcommand() {
local base name func prefix
base=$1
#!/usr/bin/env bash
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# when run in remote terminal, use the remote cli
if [ -n "$VSCODE_IPC_HOOK_CLI" ]; then
REMOTE_CLI="$(which -a 'code' | grep /remote-cli/)"
if [ -n "$REMOTE_CLI" ]; then
"$REMOTE_CLI" "$@"
@john-h-k
john-h-k / insaneTypes.ts
Created July 24, 2024 12:05
part of my type routing for my A level coursework.
import e = require("express")
import { SetOptional, Split } from "type-fest"
export type AsyncFunction<V> = (...args: never[]) => PromiseLike<V>
export type AsyncReturnType<V> = V extends AsyncFunction<infer U> ? U : V
class QueryStringError extends Error {
inner: Error | null
constructor(inner: Error | null = null) {
from __future__ import annotations
from typing import List, TypeVar, Generic, Callable, Dict, Any, TextIO, Iterable, Tuple
from functools import wraps, partial
from dataclasses import dataclass
from enum import Enum
from copy import deepcopy
import re
import operator
import importlib
import os
internal unsafe sealed class Win32EventTaskSource : IValueTaskSource
{
private IntPtr _hEvent;
public Win32EventTaskSource(IntPtr hEvent) => _hEvent = hEvent;
public void GetResult(short token)
{
_ = WaitForSingleObject(_hEvent, 0) switch
{