Skip to content

Instantly share code, notes, and snippets.

View r17x's full-sized avatar
🤘
REconciling...

RiN r17x

🤘
REconciling...
View GitHub Profile
@r17x
r17x / vim-profile.py
Created February 25, 2025 10:44
Run it ./vim-profile.py nvim
#!/usr/bin/env nix-shell
#!nix-shell -p python312Packages.matplotlib -i "python3"
# -*- coding: utf-8 -*-
#
# vim-profiler - Utility script to profile (n)vim (e.g. startup)
# Copyright © 2015 Benjamin Chrétien
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
{
"type": "excalidraw",
"version": 2,
"source": "https://excalidraw.com",
"elements": [
{
"type": "ellipse",
"version": 1944,
"versionNonce": 1294095291,
"isDeleted": false,
@r17x
r17x / nix-multi-branch-set-of-packages.flake.nix
Created November 26, 2024 07:20
nix multi-branch set of packages
{
inputs = {
## -- nixpkgs
nixpkgs-master.url = "github:NixOS/nixpkgs/master";
nixpkgs-stable.url = "github:NixOS/nixpkgs/release-24.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-specific.url = "github:NixOS/nixpkgs?rev=<HASH-COMMIT>";
nixpkgs.follows = "nixpkgs-unstable";
home-manager.url = "github:nix-community/home-manager";
@r17x
r17x / stdout_pnpm_dev.log
Created October 9, 2024 17:01
This happened when I use `facetime camera`
11:58:08 PM [vite] page reload vinxi/routes (x20)
@cap/desktop:dev: 11:58:11 PM [vite] ✨ new dependencies optimized: @solid-primitives/timer, @solid-primitives/event-listener, @tauri-apps/api/app, cva, @tauri-apps/plugin-dialog, @tauri-apps/plugin-updater, @solid-primitives/storage, @tauri-apps/api/core, @tauri-apps/api/event, @solid-primitives/context, @solid-primitives/deep, @solid-primitives/history, @solid-primitives/scheduled, @solid-primitives/websocket
@cap/desktop:dev: 11:58:11 PM [vite] ✨ optimized dependencies changed. reloading
web:dev: ✓ Compiled /api/changelog/status in 182ms (56 modules)
web:dev: GET /api/changelog/status?version=0.3.0-beta.5.5 200 in 380ms
@cap/desktop:dev: 2024-10-09 23:58:14.485 desktop[57359:2024974] _TIPropertyValueIsValid called with 16 on nil context!
@cap/desktop:dev: 2024-10-09 23:58:14.485 desktop[57359:2024974] imkxpc_getApplicationProperty:reply: called with incorrect property value 16, bailing.
@cap/desktop:dev: 2024-10-09 23:58:14.485 desktop[57359:2024974] Text
@r17x
r17x / adt_ts_pattern.tsx
Created September 4, 2024 19:42
TypeScript ADT & ts-pattern
import * as React from 'react'
import { match, P } from 'ts-pattern'
// Playground https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAKjgQwM5wEoFNkGN4BmUEIcA5FDvmQFCiSxwDecIyMuAFgDRwAKcAL5wiJcjFQBaMOxhYoAO1o1cEBangKIAeTBwAvHAAUASgMA+ZoJo0YATzBY4AOQgwAgqgDWWACYHmL2AFXwAuclcPbz8ya1V1eEjPH39DU3Ck6NTLIyYgkPCyTJTYkxt7RzgASQVgGGBkABsAGQhkX2CAcwCWfLDyGrqGlraOhU7YlTUNatr6ptb2roDTOHDB+ZGl8f0c3uD+sg3hxbGJwTLbBydTroAeABVLQ32C8lvxsl5fdmRwh6EUwScA+3UMj245iMPxgfweJnCoMezz2cD6hVBXzgMOQQkuFScADFkMBGgBXSh3ACiATJCi8WgA7gpnnBmGiDoViaSKVgsfJiFBwjS4tN4NzyZQAtTafSmSyjALoMK4GZwhLedSUcZXocNZR+VBBXjytc4ABlMm4XBYVCoZEBdno8iW6221BYnH-QHxGaum126UPSHQ36heHhf3uh0WHUct5kKN2z2-E1XSrYEBuLAAEV+ELgNMMdIZEGZzxoAB8XG5kn4q7MhgtRl0G0ing39VgtQ2k-aO+mnObYXIApns3nYXcAKqoeTmGy++BsPTg4NU7juKFQfrjuST5AQqnmXgEcKh2Hhsy7OARzBYLP7-Pr7VsDicIw7spsgB0jLqH40GybJ5JycAAETFH44GCNwQHAVBvjwd+cB-gBRjwcBoFvHwP50sAahGGQmK8EccwnC2nwmLBmFssczbbJ0yHwWhMCAcBTpgWQXaxHBHGrDeO58aqLH-mxGEcdhhx9rxtG5DiFyxn2RgEBeyAmChKE-lgAAenDIGSGjAAAblgpimpUs7yD08EKMgIBYOEGhQF0ADc8GGfId
@r17x
r17x / compress_video
Created August 22, 2024 09:19 — forked from trvswgnr/compress_video
portable shell script to compress videos with ffmpeg
#!/bin/sh
print_usage() {
echo "usage: compress_video <input_file>"
echo "supported formats: mp4, webm, mkv, mov, avi, flv"
}
get_extension() {
f="${1##*/}"
case "$f" in
@r17x
r17x / a.c
Created April 19, 2024 05:45
neovim_kavvaiii
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::
@r17x
r17x / x.js
Created April 17, 2024 18:18
react_only
const idle = () => ({ kind: 'idle' })
const loading = () => ({ kind: 'loading' })
const loaded = (data) => ({ kind: 'loaded', data })
const error = (error) => ({ kind: 'error', error })
const isLoaded = (state) => state.kind === 'loaded'
const renderWhenLoaded = (state, reactNode) => isLoaded(state)
? reactNode(state.data)
: null
Output vieskod.gif
Set Shell "fish"
Set FontSize 32
Set Width 1200
Set Height 720
Type "echo 'Welcome to Vi es kod! and I run Vi es kod! FTW 🔥🔥'" Sleep 500ms Enter
Type "alias vieskode='"nix run '"github:r17x/nvim.nix"'"'" Sleep 250ms Enter
Type "vieskode" Sleep 15s Enter
// make it "composable function for ANYTHING"
const pipe = (...args) => p => args.reduce((x, f) => f(x), p)
// promise RESOLVE handler
const pOK = f => p => p.then(f)
// promise REJECT handler
const pErr = f => p => p.catch(f)
// when promise rejected you must be handled the rejection
const responsePredicate = f => res => f(res) ? res : promise.reject(res)
// I just want 200 and request is OK
const responseOK = responsePredicate(res => res.ok && res.status === 200)