Skip to content

Instantly share code, notes, and snippets.

@pastleo
pastleo / storage-template.service.js
Created March 17, 2024 09:27
patched adding {{{albumPath}}} for immich
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
#!/usr/bin/env ruby
require 'date'
require 'net/http'
require 'uri'
require 'json'
# crontab -e
# */30 * * * * path/to/dynamic-ip.rb
@pastleo
pastleo / js-ipfs-core-config.json
Created November 10, 2021 07:48
default js-ipfs-core config
{"Addresses":{"Swarm":[],"Announce":[],"NoAnnounce":[],"API":"","Gateway":"","RPC":"","Delegates":["/dns4/node0.delegate.ipfs.io/tcp/443/https","/dns4/node1.delegate.ipfs.io/tcp/443/https","/dns4/node2.delegate.ipfs.io/tcp/443/https","/dns4/node3.delegate.ipfs.io/tcp/443/https"]},"Discovery":{"MDNS":{"Enabled":false,"Interval":10},"webRTCStar":{"Enabled":true}},"Bootstrap":["/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN","/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb","/dnsaddr/bootstrap.libp2p.io/p2p/QmZa1sAxajnQjVM8WjWXoMbmPd7NsWhfKsPkErzpm9wGkp","/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa","/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt","/dns4/node0.preload.ipfs.io/tcp/443/wss/p2p/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic","/dns4/node1.preload.ipfs.io/tcp/443/wss/p2p/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6","/dns4/node2.preload.ipfs.io/tcp/443/wss/p2p/QmV7gn
require 'erb'
require 'net/http'
DOC_TEXT = <<-DOC
# Get started:
git clone ssh://aur@aur.archlinux.org/docker-rootless-bin.git
cd docker-rootless-bin
curl https://gist.githubusercontent.com/pastleo/d3d0fd02880dbd9b30647c91d1fdb8f9/raw/mk_pkgbuild.rb > mk_pkgbuild.rb
# Update:
@pastleo
pastleo / mk_exfat_usb.sh
Last active August 2, 2020 18:22
make a exfat usb that can be used in macos and (hopefully) windows
#!/bin/bash
set -e
# https://en.wikipedia.org/wiki/ExFAT
# https://unix.stackexchange.com/questions/460155/mac-os-cannot-mount-exfat-disk-created-on-ubuntu-linux
# Preparation:
# pacman -S parted exfat-utils
@pastleo
pastleo / create_arch_media.sh
Last active June 19, 2021 10:16
create archlinux installation media
#!/bin/bash
set -e
# https://wiki.archlinux.org/index.php/USB_flash_installation_medium#Using_manual_formatting
# https://unix.stackexchange.com/questions/38164/create-partition-aligned-using-parted/49274#49274
# https://wiki.archlinux.org/index.php/Parted
# https://wiki.archlinux.org/index.php/Syslinux#Manual_install
# Preparation:
@pastleo
pastleo / setuid-experiment.c
Last active July 5, 2020 06:23
setuid experiment
#include <stdio.h>
// provides printf()
#include <stdlib.h>
// provides system()
#include <unistd.h>
// provides getuid(), geteuid(), setuid()
int main ()
@pastleo
pastleo / fibTco.js
Last active March 11, 2020 17:20
tail call optimization on fibonacci
const fib = n => (n <= 2 ? 1 : fib(n - 1) + fib(n - 2));
const fibTco = (n, a = 1, b = 1) => (n === 1 ? a : fibTco(n - 1, b, a+b));
const nth = 42;
console.log(`fib(${nth}) =`);
console.log(` ${fib(nth)}`);
console.log(`fibTco(${nth}) = `);
console.log(` ${fibTco(nth)}`);
@pastleo
pastleo / gSheetScript.js
Last active February 8, 2020 02:20 — forked from mhawksey/gist:1276293
Google spreadsheet and App Script as backend - insert data to a google spreadsheet via POST or GET
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@pastleo
pastleo / howdy-face-recognition-arch-kde.md
Last active April 12, 2024 06:34
Setup face recognition authentication on ArchLinux and KDE Plasma using howdy

Setup face recognition authentication on ArchLinux and KDE Plasma using howdy

This is surprisingly easy...basically following Arch Wiki:

https://wiki.archlinux.org/index.php/Howdy

After some investigation, here is step by step and preferences

Install howdy