Add a few makefiles for various operations.
This commit is contained in:
parent
988307e09e
commit
2114d03c4c
3 changed files with 76 additions and 0 deletions
24
mk/audio.mk
Normal file
24
mk/audio.mk
Normal file
|
@ -0,0 +1,24 @@
|
|||
# -prf "asendcmd=0.0 afftdn sn start,asendcmd=2 afftdn sn stop,afftdn=nr=10:nf=-40" \
|
||||
|
||||
SRC ?= tmp.opus
|
||||
record-audio:
|
||||
record-audio.sh $(SRC)
|
||||
|
||||
record-video:
|
||||
record-video.sh $(SRC)
|
||||
|
||||
OUTPUT ?= tmp.opus
|
||||
extract-audio:
|
||||
ffmpeg -i $(SRC) $(OUTPUT)
|
||||
|
||||
normalize:
|
||||
@# f: force overriding previous files
|
||||
@# koa: keep original audio
|
||||
@# pr: progress
|
||||
@# -nt {ebu,rms,peak}: normalization type (default is "ebu", which is what we want)
|
||||
@# -t TARGET_LEVEL: target db/LUFS level (default is "-23")
|
||||
@# (for EBU) -lrt LOUDNESS_RANGE_TARGET: max audio range (default is "7")
|
||||
@#
|
||||
@# ffmpeg options
|
||||
@# -c:a AUDIO_CODEC
|
||||
ffmpeg-normalize -f -koa -pr -c:a libopus $(SRC)
|
8
mk/random.mk
Normal file
8
mk/random.mk
Normal file
|
@ -0,0 +1,8 @@
|
|||
APP ?= my-app
|
||||
strace-pid:
|
||||
@# strace an already running application
|
||||
sudo strace -p $$(pidof $(APP))
|
||||
|
||||
strace:
|
||||
@# --decode-fds = get file names
|
||||
sudo strace --decode-fds -e desc,network $(APP)
|
44
mk/zram.mk
Normal file
44
mk/zram.mk
Normal file
|
@ -0,0 +1,44 @@
|
|||
PDNSDIR ?= /tmp/zram
|
||||
|
||||
# Currently not working with alpine linux.
|
||||
zram: mkdir zram-module zram-create zram-format zram-mount
|
||||
unzram: zram-umount zram-free
|
||||
|
||||
btrzram: mkdir zram-module zram-create btrzram-format zram-mount
|
||||
|
||||
mkdir:; -mkdir $(PDNSDIR) 2>/dev/null
|
||||
|
||||
zram-module:; modprobe zram
|
||||
zram-create:; zramctl --find --size 50000M -a zstd
|
||||
|
||||
# -b 2048 block size, cannot be used (mkfs.ext4 wants 4k blocks minimum)
|
||||
# -N xxx nb of inodes
|
||||
# -i xxx higher inode ratio
|
||||
zram-format:; mkfs.ext4 -N 50000000 /dev/zram0
|
||||
zram-mount:; mount /dev/zram0 $(PDNSDIR)
|
||||
|
||||
zram-umount:; -umount $(PDNSDIR)
|
||||
zram-free:; -zramctl -r /dev/zram0
|
||||
|
||||
BTRFS_DIR ?= /tmp/btrfs
|
||||
BTRFS_IMG ?= /tmp/btrfs.img
|
||||
BTRFS_SIZ ?= 5000
|
||||
BTRFS_SECTOR_SIZE ?= 4096
|
||||
BTRFS_NODE_SIZE ?= 4096 # Minimal accepted value.
|
||||
BTRFS_LOOP ?= /dev/loop100
|
||||
BTRFS_COMP ?= zstd:8
|
||||
|
||||
# apt install btrfs-progs
|
||||
btrfs: btrfs-mkdir btrfs-create btrfs-loop btrfs-format btrfs-mount btrfs-chown
|
||||
btrfs-mkdir:; [ ! -d $(BTRFS_DIR) ] && mkdir $(BTRFS_DIR) 2>/dev/null || :
|
||||
btrfs-create:
|
||||
[ ! -f $(BTRFS_IMG) ] && su karchnu -c "dd if=/dev/zero of=$(BTRFS_IMG) bs=1M count=$(BTRFS_SIZ)" || :
|
||||
btrfs-loop:; losetup --sector-size $(BTRFS_SECTOR_SIZE) $(BTRFS_LOOP) $(BTRFS_IMG)
|
||||
btrfs-format:; mkfs.btrfs -s $(BTRFS_SECTOR_SIZE) -n $(BTRFS_NODE_SIZE) -L BTRDATA $(BTRFS_LOOP)
|
||||
btrfs-mount:; mount -o compress=$(BTRFS_COMP) $(BTRFS_LOOP) $(BTRFS_DIR)
|
||||
btrfs-chown:; chown karchnu $(BTRFS_DIR)
|
||||
|
||||
unbtrfs: btrfs-umount btrfs-unloop btrfs-rm
|
||||
btrfs-unloop:; [ -b $(BTRFS_LOOP) ] && losetup -d $(BTRFS_LOOP) || :
|
||||
btrfs-umount:; umount $(BTRFS_DIR)
|
||||
btrfs-rm:; rm $(BTRFS_IMG)
|
Loading…
Add table
Reference in a new issue