Skip to content

Instantly share code, notes, and snippets.

Avatar

reaper barelyhuman

View GitHub Profile
@barelyhuman
barelyhuman / *doc-generator.md
Created Nov 4, 2022
Single script for doc generation
View *doc-generator.md

Doc Generator

Single file doc generator for javascript projects where no other programming language is available.

This was a learning project for working with reactive streams for CLI apps and something I needed at work to generate wiki sites from an existing docs folder.

There's an attached Dockerfile if you wish to deploy it on a container, the script is for flat docs folders with all docs on the first level of the folder a.k.a nested documents aren't supported right now.

@barelyhuman
barelyhuman / sizesnap.js
Created Oct 30, 2022
Pure ESM version of sizesnap cli
View sizesnap.js
import glob from 'tiny-glob'
import _xs from 'xstream'
import zlib from 'zlib'
import {promises as fs} from 'node:fs'
import _concat from 'xstream/extra/concat.js'
const xs = _xs.default
const concat = _concat.default
// contained exec of the streams
View *notion-vuepress-sync.md

Notion Vuepress Sync

The script simply syncs from a notion database and renders the content of the pages created inside the table based on the following structure.

title type published
page name FAQ [x]
another page Category [x]
@barelyhuman
barelyhuman / .vimrc
Last active Jan 31, 2023
self sufficient single Vim file for a minimal, portable vim
View .vimrc
" plugs
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin()
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
@barelyhuman
barelyhuman / hide-explorer-arrows-vscode.sh
Created Aug 12, 2022
hide arrows for an icon them in vscode
View hide-explorer-arrows-vscode.sh
#!/usr/bin/env bash
ext_root="$HOME/.vscode/extensions/"
cd $ext_root
extension_dir=$(ls . | grep miguelsolorio.symbols)
cd $extension_dir
jq -n -f ./src/symbol-icon-theme.json | cat > .tmp
npx json -I -e "this.hidesExplorerArrows=true;" -f .tmp
mv ./src/symbol-icon-theme.json ./src/symbol-icon-theme.json.bak
mv .tmp ./src/symbol-icon-theme.json
View gray-palette.json
[
{
"name": "gray-100",
"color": "rgba(25, 24, 21, 1)"
},
{
"name": "gray-75",
"color": "rgba(113, 113, 113, 1)"
},
{
@barelyhuman
barelyhuman / boring.itermcolors
Created Jul 25, 2022
iterm colors based on Plastic Theme + RSMS Gray colors
View boring.itermcolors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.44705882668495178</real>
View default.nix
with (import <nixpkgs> {});
with (import /home/maarten/code/nixos/yarn2nix { inherit pkgs; });
let
gems = bundlerEnv {
name = "project-name";
inherit ruby;
gemdir = ./.;
};
in stdenv.mkDerivation {
name = "project-name";
@barelyhuman
barelyhuman / availability_function.sql
Created Jun 2, 2022
get open time slots for bookings where bookings can be overlapped if there's more than one slot for booking (postgres)
View availability_function.sql
-- table structure for reference
-- `areas`
-- column type nullable
-- ------------------------------
-- id int4 NO
-- name varchar(11) YES
-- slots int4 NO
--
-- `avail`
-- column type nullable
@barelyhuman
barelyhuman / script.js
Created Apr 16, 2022
wonka (wonka.kitten.sh) , custom operators code
View script.js
import { fromArray, fromValue, pipe, toPromise } from "wonka";
function talkbackPlaceholder(a) {}
const customTake = (max) => (source) => (sink) => {
let taken = [];
let talkback = talkbackPlaceholder;
let ended = false;
return source((signal) => {
if (typeof signal === "number") {