Skip to content

Instantly share code, notes, and snippets.

View lpenaud's full-sized avatar
💻
Working

Loïc Penaud lpenaud

💻
Working
View GitHub Profile
@lpenaud
lpenaud / split-mp3.sh
Created March 17, 2024 16:19
Split mp3
#!/bin/bash
if [ $# -ne 3 ]; then
printf "Usage: %s LIST INFILE OUTDIR\n" "${0}"
exit 1
fi
function add_seconds () {
echo $(( $1 + $2 ))
}
@lpenaud
lpenaud / export-picture.sh
Created April 6, 2024 20:18
Export folder picture from flac
#!/bin/bash
if [ $# -eq 0 ]; then
printf "Usage: %s INDIR [...INDIRS]\n" "${0}" >&2
exit 1
fi
# track
function get_mimetype () {
local line
@lpenaud
lpenaud / radio-browser.ts
Created May 8, 2024 14:07
Generate m3u playlist from radio-browser.info
import { CsvParseStream } from "https://deno.land/[email protected]/csv/mod.ts";
export interface RadioSearchOptions {
hidebroken?: boolean;
order?: "clickcount";
reverse?: boolean;
language?: string;
tagList?: string;
codec?: string;
limit?: number;
@lpenaud
lpenaud / Activity.md
Last active August 12, 2025 19:27
Copy file with the modified time

Activity

A script to sync activities *.FIT from my Garmin smartwatch.

Usage

Strict

deno run https://gist.githubusercontent.com/lpenaud/4bc8dce6c69d80a3a65bf4c59b4c4e5a/raw/activity.ts INDIR OUTDIR
@lpenaud
lpenaud / lnr.ts
Last active March 4, 2025 19:38
Create physical link recursively
#!/usr/bin/env -S deno run --allow-read --allow-write
import {
walk,
type WalkEntry,
type WalkOptions,
} from "https://deno.land/[email protected]/fs/walk.ts";
import * as path from "https://deno.land/[email protected]/path/mod.ts";
async function* multiWalk(roots: string[], options?: WalkOptions) {
for (const root of roots) {
@lpenaud
lpenaud / walk-series.ts
Last active January 28, 2025 22:19
Create physical link between download and media directory
#!/usr/bin/env -S deno run --allow-read --allow-write
import { walk } from "https://deno.land/[email protected]/fs/walk.ts";
import * as cli from "https://deno.land/[email protected]/cli/mod.ts";
import * as path from "https://deno.land/[email protected]/path/mod.ts";
interface UnixFilesystemOptions {
uid: number | null;
gid: number | null;
filemod: number;
dirmod: number;
@lpenaud
lpenaud / slideshow.md
Last active February 4, 2025 10:02
Gnome slideshow

Gnome slideshow

Generate a slideshow to GNOME desktop background.

Usage

slideshow.sh INDIR > "slideshow.$(date -I).xml"
@lpenaud
lpenaud / bash-random.md
Last active August 21, 2024 16:23
Bash random

Bash random

Functions utils to play with random number.

Examples

Get randomly a number between 0 to 10 or 5.

if rand::boolean; then
@lpenaud
lpenaud / header.html
Last active January 18, 2025 05:00 — forked from killercup/pandoc.css
Add style to pandoc HTML render.
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.esm.min.mjs';
mermaid.initialize({ startOnLoad: false });
await mermaid.run({
nodes: document.querySelectorAll('pre.mermaid > code:first-child'),
});
function findMermaidSvg(child) {
if (child.tagName === "A" || child.tagName === "BUTTON") {
return null;
@lpenaud
lpenaud / rsync-english.md
Last active February 25, 2025 09:00
Backup files

Backup files with rsync

Incremental backup

rsync -a --delete -Pau INDIR [INDIRS...] OUTDIR
  • -a: Archive mode copy the access rights.
  • --delete: Remove files if there aren't in the source directory anymore.