Skip to content

Instantly share code, notes, and snippets.

View raspi's full-sized avatar

raspi

  • finland
  • 11:40 (UTC +03:00)
View GitHub Profile
#!/bin/bash
# source_*.png (source_1234.png) to mkv
find . -type f -iname "*.png" -printf "%f\n" | sort -n | xargs cat | ffmpeg -f image2pipe -i - output.mkv
@raspi
raspi / list_ff_open_handles.sh
Created August 3, 2023 00:07
List firefox open handles
pgrep -fi firefox | xargs -I{} find /proc/{}/fd -readable -type l -printf '%p%f: %l\n'
# Local chat with socat
# Server runs:
socat ABSTRACT-LISTEN:@chat,socktype=5,fork STDOUT
# Client:
socat ABSTRACT-CONNECT:@chat,socktype=5 -
from itertools import permutations
from typing import Generator, List
def gen(s: List[str]) -> Generator:
for i in permutations(s, len(s)):
yield list(i)
def acro(a:List[str]) -> Generator:
for i in gen(a):
firsts:List[str] = []
SELECT
d.datname db
FROM
pg_catalog.pg_database d
WHERE
d.datname NOT LIKE ALL (ARRAY ['template%', 'postgres'])
ORDER BY 1;
@raspi
raspi / setup_namespace_network.sh
Created August 14, 2022 16:57
Setup Linux namespace network with virtual bridge
#!/bin/bash
# (C) Pekka Järvinen 2022
# Name for bridge which virtual namespaces will use to communicate with each other
BRIDGENAME="gamebr0"
# Prefix for network
NETPREFIX="192.168.255."
# Starting IP (NETPREFIX + this)
let STARTIP=10

Cakez TD demo on Linux Steam

Download from https://cakez77.itch.io/cakeztd

First unzip the demo .zip with Ark.

After unzipping you'll have broken filenames in single directory:

% LANG=C ls
@raspi
raspi / ffprobe_json.py
Created December 9, 2021 01:34
Get JSON from FFProbe
import json
import subprocess
from pathlib import Path
def ffprobe(path: Path):
cmd = [
"ffprobe",
"-v", "error",
"-select_streams", "v",
"-show_entries", "format=filename:stream=height",
@raspi
raspi / censor.sh
Created March 27, 2021 01:20
Censor MAC address, IPv4 address from some output
# mac:
echo "..." | perl -pe 's@[\da-f:]{17}@xx:xx:xx:xx:xx:xx@ig'
# IPv4
echo "..." | perl -pe 's@[\d\.]{7,15}@X.X.X.X@ig'
@raspi
raspi / list-kernel-modules.py
Created March 26, 2021 22:01
List all loadable kernel modules
import json
import subprocess
import sys
from pathlib import Path
skipped_keys = [
'sig_id',
'signer',
'sig_key',
'sig_hashalgo',