Installing print server and drivers.
- Install CUPS:
sudo apt install cups
export enum KnownPaths { | |
GetHelp = "/app/get-help", | |
RunDetail = "/app/history/:runId" | |
} | |
/** Parses a string type into an object of route params */ | |
type ExtractRouteParams<T extends string> = string extends T | |
? Record<string, string> | |
: T extends `${infer _Start}:${infer Param}/${infer Rest}` | |
? { [K in Param | keyof ExtractRouteParams<Rest>]: string } |
async function importURL(url) { | |
const vm = require("vm"); | |
const res = await fetch(url).then((r) => r.text()); | |
return vm.runInThisContext(res, { filename: url }); | |
} | |
// Example usage: | |
// | |
// await importURL( | |
// "https://gist.githubusercontent.com/blakek/660a8881ae56641d8804971b848df17e/raw/0fb0ec0646d5c8dc353dd9dadc9f5d8ccb7821b2/queryStringParse.js" |
#!/usr/bin/env bash | |
set -eo pipefail | |
## | |
# Transpose a song from one key to another. | |
## | |
version='0.0.1' | |
# Formatting functions |
const PI = 3.14; | |
const CircleSize = { | |
Quarter: 0.25, | |
Half: 0.5, | |
Full: 1, | |
}; | |
type WithRadiusOrDiameter = { r?: number; d?: number }; | |
type WithPercent = { percent: typeof CircleSize[keyof typeof CircleSize] }; |
function exec(command: string, args?: string[]): Promise<void> { | |
return new Promise((resolve, reject) => { | |
const child = spawn(command, args, { stdio: "inherit" }); | |
child.on("close", (code) => { | |
if (code === 0) { | |
resolve(); | |
} else { | |
reject(new Error(`Command failed with code ${code}`)); | |
} |
#! /usr/bin/env bash | |
merged=() | |
unmerged=() | |
for branch in $(git for-each-ref --format="%(refname:short)" refs/heads); do | |
if wasBranchMerged "$branch" staging; then | |
merged+=("$branch") | |
else | |
unmerged+=("$branch") |
{ | |
// Use IntelliSense to learn about possible attributes. | |
// Hover to view descriptions of existing attributes. | |
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Run current file", | |
"type": "node", | |
"request": "launch", |
function parseDate(dateString: unknown): Date | undefined { | |
// No date string was passed | |
const isKnownType = | |
typeof dateString === "string" || | |
typeof dateString === "number" || | |
dateString instanceof Date; | |
if (!isKnownType || !dateString) { | |
return undefined; | |
} |
import * as React from "react"; | |
import { useTabVisibility } from "./useTabVisibility"; | |
export interface UsePollOptions { | |
/** Calculate what the wait time (in ms) should be between polls */ | |
backoffFunction: (pollCount: number) => number; | |
} | |
export interface UsePollCallbackParameters { |