Skip to content

Instantly share code, notes, and snippets.

View zkat's full-sized avatar
💭
Rusting it up

Kat Marchán zkat

💭
Rusting it up
View GitHub Profile
@zkat
zkat / config.kdl
Last active February 13, 2024 06:40
Example Niri config using KDL v2
input {
touchpad {
tap
natural-scroll
}
mouse {
// natural-scroll
// accel-speed 0.2
// accel-profile "flat"
@zkat
zkat / Dockerfile.kdl
Last active December 11, 2023 19:48
Dockerfile in KDL
// This file is a translation of https://gitea.treehouse.systems/treehouse/mastodon/src/branch/main/Dockerfile to KDL
// This needs to be bookworm-slim because the Ruby image is built on bookworm-slim
ARG NODE_IMAGE="node:20.8-bookworm-slim"
ARG RUBY_IMAGE="ghcr.io/moritzheiber/ruby-jemalloc:3.2.2-slim"
// hadolint ignore=DL3006
FROM "${RUBY_IMAGE}" as="ruby"
// build-base
@zkat
zkat / docker-compose.kdl
Created December 11, 2023 19:19
Docker Compose in KDL
// This is a KDL translation of https://gitea.treehouse.systems/treehouse/mastodon/src/branch/main/docker-compose.yml,
// with some examples of proposed KDL 2.0 grammar sprinkled in with comments.
version "3"
services {
db {
restart "always"
image "postgres:14-alpine"
shm_size "256mb"
networks {
- "internal_network"
@zkat
zkat / index.js
Last active April 10, 2023 15:41
testing single-file packages
/**package
{
"name": "test-pkg",
"version": "1.2.3",
"dependencies": {
"lodash": "*",
}
}
**/
console.log('hello');
@zkat
zkat / measures.rs
Last active September 24, 2022 23:42
WeightedMeasure impl example
use crate::Score;
pub trait Measure: std::fmt::Debug + Sync + Send {
fn calculate(&self, scores: Vec<(&Score, f32)>) -> f32;
}
#[derive(Debug, Clone, Default)]
pub struct WeightedMeasure;
impl Measure for WeightedMeasure {
@zkat
zkat / embark_profiles.txt
Created April 13, 2020 04:14 — forked from passcod/embark_profiles.txt
Dwarf Fortress configs
[PROFILE]
[TITLE:WELL-PREPPED (0XABADIDEA STYLE)]
[SKILL:1:MINING:5]
[SKILL:1:HAMMER:2]
[SKILL:1:SWIMMING:2]
[SKILL:1:MELEE_COMBAT:1]
[SKILL:2:MINING:5]
[SKILL:2:SWORD:2]
[SKILL:2:CROSSBOW:2]
[SKILL:2:SWIMMING:1]
@zkat
zkat / ABNF
Last active March 21, 2018 17:49
pattern matching sketch
// match ABNF
Match := 'match' '(' RHSExpr ')' '{' MatchClause* '}'
MatchClause := MatchClauseLHS '=>' FatArroyRHS MaybeASI
MatchClauseLHS := [MatcherExpr] (LiteralMatcher | ArrayMatcher | ObjectMatcher | JSVar)
MatcherExpr := LHSExpr
LiteralMatcher := LitRegExp | LitString | LitNumber
ArrayMatcher := '[' MatchClauseLHS [',', MatchClauseLHS]* ']' // and... whatever it takes to shove ...splat in there
ObjectMatcher := '{' (JSVar [':' MatchClauseLHS]) [',' (JSVar [':', MatchClauseLHS])]* '}' // see above note about ...splat
@zkat
zkat / index.js
Last active December 16, 2017 02:29
find the cached version that's closest to a given spec
'use strict'
const BB = require('bluebird')
const cacache = require('cacache')
const npa = require('npm-package-arg')
const pickManifest = require('npm-pick-manifest')
const ssri = require('ssri')
module.exports = cachedVersions
@zkat
zkat / README.md
Created June 29, 2017 22:41
real-world vue app

This is a useful package.json from an actual user, as opposed to an artificial/fabricated app. It should be fairly representative of the sort of things users do.

@zkat
zkat / index.js
Created June 29, 2017 00:06 — forked from junosuarez/index.js
async cli app boilerplate
#!/usr/bin/env node
if (process.mainModule === module) setImmediate(() => main(process.argv).catch(e => console.log(e.stack) && process.exit(1)))
async function main(argv) {
console.log(argv.slice(2))
}