add bins and alternatives

This commit is contained in:
JOLIMAITRE Matthieu 2024-06-18 03:52:40 +02:00
parent a935bb9893
commit 9f3594e0d3
21 changed files with 210 additions and 10 deletions

View file

@ -0,0 +1,17 @@
#!/bin/sh
echo 0x6a j ┘
echo 0x6b k ┐
echo 0x6c l ┌
echo 0x6d m └
echo 0x6e n ┼
echo 0x71 q ─
echo 0x74 t ├
echo 0x75 u ┤
echo 0x76 v ┴
echo 0x77 w ┬
echo 0x78 x │
echo ┌─┬┐
echo │ ││
echo ├─┼┤
echo └─┴┘

6
data/home/.local/bin/choose.ts Executable file
View file

@ -0,0 +1,6 @@
#!/bin/env -S deno run
const args = Deno.args;
const { floor, random } = Math;
const index = floor(random() * args.length);
console.log(args[index]);

View file

@ -0,0 +1,3 @@
#!/bin/sh
thunar --daemon

3
data/home/.local/bin/defer.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh

View file

@ -0,0 +1,3 @@
#!/bin/sh
sh -c 'echo "console.clear()"; cat' | deno

View file

@ -0,0 +1,22 @@
#!/bin/sh
echo "done" > "/tmp/done.txt"
set -e
sleep 15s
function enable_wol_for() {
echo "[enable_wol] enabling wol on '$1'"
sudo ethtool -s $1 wol g
echo "[enable_wol] success"
sudo ethtool $1 | grep Wake-on
}
for _ in $(seq 10)
do
ip link | grep enp | while read line; do
name=$(echo "$line" | cut -d ":" -f 2)
enable_wol_for "$name"
done
sleep 10s
done

View file

@ -0,0 +1,3 @@
#!/bin/sh
pkill -HUP -f "cinnamon --replace"

3
data/home/.local/bin/glava.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
glava -d

View file

@ -0,0 +1,3 @@
#!/bin/sh
killall nemo-desktop

30
data/home/.local/bin/mk_vm.sh Executable file
View file

@ -0,0 +1,30 @@
#!/bin/sh
path=$1;
DISK_GB=4;
CPU_COUNT=8;
MEM_MB=2048;
if [ $# -eq 0 ]; then
name="vm_$(date +%s)"
path="/tmp/$name"
fi
echo "[mk_vm.sh] creating '$path'";
mkdir -p "$path";
cd "$path";
if ! [ -f ./arch.iso ]; then
wget "http://archlinux.mirrors.ovh.net/archlinux/iso/latest/archlinux-x86_64.iso" -O "./arch.iso";
fi
if ! [ -f ./root.img ]; then
qemu-img create root.img "$DISK_GB"G;
fi
# ARGS_GRAPHICS="-display egl-headless"
# ARGS_GRAPHICS="-nographic"
ARGS="-drive file=root.img,format=raw -cdrom arch.iso -boot d -smp $CPU_COUNT -m $MEM_MB $ARGS_GRAPHICS"
screen -S vm qemu-system-x86_64 $ARGS;

View file

@ -0,0 +1,5 @@
#!/bin/sh
wget --quiet "https://poupette.barnulf.net/poupette.webp" -O "/tmp/poupette.webp"
convert "/tmp/poupette.webp" -resize 600x-1 "/tmp/poupette.jpg"
kitty +kitten icat "/tmp/poupette.jpg"

View file

@ -1,5 +0,0 @@
#!/bin/sh
while read line
do echo "$@$line"
done

33
data/home/.local/bin/prefix.ts Executable file
View file

@ -0,0 +1,33 @@
#!/bin/env -S deno run
import { crayon } from "https://deno.land/x/crayon@3.3.3/mod.ts";
async function read_line() {
const buf = new Uint8Array(1024);
const n = await Deno.stdin.read(buf);
if (n === null) return null;
const line = new TextDecoder().decode(buf.subarray(0, n));
return line;
}
function pick<T>(arr: T[]) {
const index = Math.floor(arr.length * Math.random());
return arr[index];
}
const [prefix] = Deno.args;
const colors = [
crayon.red,
crayon.green,
crayon.blue,
crayon.yellow,
crayon.magenta,
];
const color = pick(colors);
while (true) {
let line = await read_line();
if (line == null) break;
line = line.substring(0, line.length - 1);
console.log(`${color(`[${prefix}]`)} ${line}`);
}

View file

@ -0,0 +1,17 @@
#!/bin/env -S deno run -A
import { basename, dirname } from "https://deno.land/std@0.187.0/path/mod.ts";
const files = Deno.args;
function rand_int(ceil = 1000) {
return Math.floor(Math.random() * ceil);
}
const keyed = files.map((name) => ({ key: rand_int(files.length), name }));
keyed.sort(({ key: a }, { key: b }) => (a - b));
await Promise.all(keyed.map(({ name }, index) => {
const dir = dirname(name);
const base = basename(name);
return Deno.rename(`${dir}/${base}`, `${dir}/${index}_${base}`);
}));

View file

@ -0,0 +1,7 @@
#!/usr/bin/env -S deno run -A --unstable
const path = Deno.env.get("HOME") + "/.config/discord/settings.json"
const config = JSON.parse(Deno.readTextFileSync(path));
config["SKIP_HOST_UPDATE"] = true;
Deno.writeTextFileSync(path, JSON.stringify(config, null, 4));

View file

@ -0,0 +1,5 @@
#!/bin/sh
name="screenshot-$(date +%s).png"
gnome-screenshot -a -f /tmp/$name
xclip -selection clipboard -t image/png -i /tmp/$name

View file

@ -0,0 +1,37 @@
#!/bin/env -S deno run -A
import { crayon } from "https://deno.land/x/crayon@3.3.3/mod.ts";
const [filename] = Deno.args;
const args = [filename];
const { stdout } = await new Deno
.Command("strings", { args, stdout: "piped" })
.output();
const strings = new TextDecoder().decode(stdout);
let passed = false;
let rest = strings.split("\n").filter((l) => {
if (l === "IDATx") passed = true;
return !passed;
}).join("\n");
function split_once(text: string, sep: string) {
const [first, ...rest] = text.split(sep);
return [first, rest.join(sep)];
}
let _, prompt, negative, settings;
[_, rest] = split_once(rest, "parameters\n");
[prompt, rest] = split_once(rest, "\nNegative prompt: ");
[negative, rest] = split_once(rest, "\nSteps: ");
[settings, _] = split_once(rest, "\nIDATx");
settings = "Steps: " + settings;
const pairs = settings.split(", ").map((p) => split_once(p, ": "));
for (const [key, value] of pairs) {
console.log(`${crayon.yellow.bold((key + ":").padEnd(12))} ${value}`);
}
console.log(`${crayon.yellow.bold("prompt:")}
${prompt}
${crayon.yellow.bold("negative:")}
${negative}`);

View file

@ -0,0 +1,3 @@
#!/bin/sh
rustdesk

View file

@ -0,0 +1,2 @@
#!/bin/sh
corectrl --minimize-systray

View file

@ -0,0 +1,3 @@
#!/bin/sh
tail --pid="${1}" -f /dev/null

View file

@ -83,13 +83,13 @@ alias "...."="../../.."
alias "....."="../../../.."
# edit default commands
alias ls=lsd
[ -f /usr/bin/lsd ] && alias ls=lsd
alias bat="/usr/bin/bat --theme=ansi"
alias cat="bat --paging=never --style=snip"
alias cut=tuc
alias make="/usr/bin/make -j32"
[ -f /usr/bin/bat ] && alias cat="bat --paging=never --style=snip"
[ -f /usr/bin/tuc ] && alias cut=tuc
alias make="/usr/bin/make -j$(nproc)"
alias mek=make
alias code="codium"
[ -f /usr/bin/codium ] && alias code="codium"
alias untar="tar -xvf"
alias paru="unset CARGO_TARGET_DIR; paru"
alias pandoc="pandoc --pdf-engine=tectonic"