Compare commits
7 Commits
de3b5b8623
...
32c4948ac7
| Author | SHA1 | Date | |
|---|---|---|---|
| 32c4948ac7 | |||
| 6f7233a552 | |||
| c3a78c7bbc | |||
| 870cf7b1f6 | |||
| 281d133207 | |||
| 68104a86f7 | |||
| 9baf826b39 |
@ -80,7 +80,7 @@
|
|||||||
% Umklammerungen
|
% Umklammerungen
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
% Mengendefinition mit Trennstrich
|
% Mengendefinition mit Trennstrich {2x | x = 1,...,n}
|
||||||
\newcommand{\set}[2]{\left\lbrace#1\,\middle\vert\,#2\right\rbrace}
|
\newcommand{\set}[2]{\left\lbrace#1\,\middle\vert\,#2\right\rbrace}
|
||||||
|
|
||||||
% Bedingte Wahrscheinlichkeit mit Trennstrich
|
% Bedingte Wahrscheinlichkeit mit Trennstrich
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
; TODO: More ffmpeg, yt-dlp
|
; ===========================
|
||||||
|
; NIXOS
|
||||||
|
; ===========================
|
||||||
|
|
||||||
% nixos, nixos-rebuild
|
% nixos, nixos-rebuild, flake
|
||||||
# Rebuild a flake system derivation
|
# Rebuild a flake system derivation
|
||||||
sudo nixos-rebuild <type> --flake .#<flake>
|
sudo nixos-rebuild <type> --flake .#<flake>
|
||||||
$ type: echo -e "switch\nbuild\nboot"
|
$ type: echo -e "switch\nbuild\nboot"
|
||||||
@ -10,99 +12,97 @@ $ flake: echo -e "nixinator\nnixtop"
|
|||||||
# Find out why a package is included in the closure when building the system derivation
|
# Find out why a package is included in the closure when building the system derivation
|
||||||
nix why-depends /run/current-system nixpkgs#<package>
|
nix why-depends /run/current-system nixpkgs#<package>
|
||||||
|
|
||||||
; TODO: Autocomplete executable, list everything in path
|
|
||||||
% nixos, nix-store, storepath, link
|
% nixos, nix-store, storepath, link
|
||||||
# Find the storepath of an executable in the users path
|
# Find the storepath of an executable in the users path
|
||||||
readlink -f $(which <executable>)
|
readlink -f $(which <executable>)
|
||||||
|
$ executable: bash -c "compgen -c"
|
||||||
|
|
||||||
; TODO: Autocomplete executable, list everything in path
|
|
||||||
% nixos, nix-store, storepath, libraries
|
% nixos, nix-store, storepath, libraries
|
||||||
# Find the wanted dynamic libraries of an executable in the users path
|
# Find the wanted dynamic libraries of an executable in the users path
|
||||||
ldd $(readlink -f $(which <executable>))
|
ldd $(readlink -f $(which <executable>))
|
||||||
|
$ executable: bash -c "compgen -c"
|
||||||
|
|
||||||
|
; ===========================
|
||||||
|
; SHELL
|
||||||
|
; ===========================
|
||||||
|
|
||||||
% shell, process
|
% shell, process
|
||||||
# Launch a detached process with suppressed output
|
# Launch a detached process with suppressed output
|
||||||
<command> &>/dev/null &
|
<command> &>/dev/null &; disown
|
||||||
|
|
||||||
; TODO: Filter out directories from input autocomplete (if there are no directories basic grep doesn't work, always needs a pattern)
|
|
||||||
% ffmpeg, slowmo
|
|
||||||
# Create a slow motion version of a video with interpolated/blended frames
|
|
||||||
ffmpeg -i "<input>" -filter:v "minterpolate='mi_mode=mci:mc_mode=aobmc:vsbmc=1:fps=<doublefps>',setpts=2*PTS" output.mp4
|
|
||||||
$ input: eza -1
|
|
||||||
|
|
||||||
% ffmpeg, cropdetect
|
|
||||||
# Detect black bar dimensions automatically by looking at the first 10 frames
|
|
||||||
ffmpeg -i "<input>" -vframes 10 -vf cropdetect -f null -
|
|
||||||
$ input: eza -1
|
|
||||||
|
|
||||||
% ffmpeg, cropdetect, preview
|
|
||||||
# Preview video with applied crop settings
|
|
||||||
ffplay -vf crop=<width>:<height>:<x>:<y> "<input>"
|
|
||||||
$ input: eza -1
|
|
||||||
|
|
||||||
% ffmpeg, cropdetect, render
|
|
||||||
# Re-encode the video with applied crop settings
|
|
||||||
ffmpeg -i "<input>" -vf crop=<width>:<height>:<x>:<y> -c:a copy output.mp4
|
|
||||||
$ input: eza -1
|
|
||||||
|
|
||||||
% ffmpeg, video compression, h265, render, reencode
|
|
||||||
# Reencode and compress the video using the h265 codec
|
|
||||||
ffmpeg -i "<input>" -vcodec libx265 -crf <quality> "out_<input>"
|
|
||||||
$ input: eza -1
|
|
||||||
$ quality: echo -e "24\n25\n26\n27\n28\n29\n30\n"
|
|
||||||
|
|
||||||
; TODO: Setting the default values like this makes them the only possible values
|
|
||||||
% ffmpeg, video compression, h256, render, reencode
|
|
||||||
# Reencode and compress multiple videos using the h265 codec
|
|
||||||
fish -c "for name in <files>; ffmpeg -i '$name' -vcodec libx265 -crf <quality> 'out_$name'; end"
|
|
||||||
$ files: echo "(eza -1 | grep \".mp4\")"
|
|
||||||
$ quality: echo "28"
|
|
||||||
|
|
||||||
% qemu, cpu
|
|
||||||
# Find out what features are supported by different qemu CPUs
|
|
||||||
qemu-system-<arch> -cpu help
|
|
||||||
|
|
||||||
; https://github.com/flathub/com.discordapp.Discord/wiki/Rich-Precense-(discord-rpc)
|
|
||||||
% discord, flatpak, rich-presence
|
|
||||||
# Enable rich presence for flatpak Discord
|
|
||||||
ln -sf $XDG_RUNTIME_DIR/{app/com.discordapp.Discord,}/discord-ipc-0
|
|
||||||
|
|
||||||
% find
|
|
||||||
# Find files under a certain size in the current directory
|
|
||||||
find . -type f -name "<glob>" -size -<size>
|
|
||||||
|
|
||||||
% objdump, disassemble
|
|
||||||
# Disassemble an object file
|
|
||||||
objdump -d -S -M intel "<file>" | bat -l nasm
|
|
||||||
$ file: eza -1
|
|
||||||
|
|
||||||
% pdftocairo, pdf, svg
|
|
||||||
# Extract svg figure from pdf page
|
|
||||||
pdftocairo -f <page> -l <page> -svg "<input>" "<output>"
|
|
||||||
$ input: eza -1
|
|
||||||
|
|
||||||
% yes, head, file
|
% yes, head, file
|
||||||
# Generate a large text file
|
# Generate a large text file
|
||||||
yes "The quick brown fox jumps over the lazy dog" | head -c <size> > <output>
|
yes "The quick brown fox jumps over the lazy dog" | head -c <size> > <output>
|
||||||
|
|
||||||
% hotspot, create_ap, wifi, wihotspot
|
|
||||||
# Open a WiFi Hotspot using "wihotspot"
|
|
||||||
sudo create_ap wlp5s0 enp0s31f6 Potshot ThisIsMyPotshot --daemon --hidden
|
|
||||||
|
|
||||||
% hotspot, create_ap, wifi, wihotspot
|
|
||||||
# List running Hotspots
|
|
||||||
sudo create_ap --list-running
|
|
||||||
|
|
||||||
% hotspot, create_ap, wifi, wihotspot
|
|
||||||
# List connected devices
|
|
||||||
watch -d -c -n 0.5 sudo create_ap --list-clients <SSID>
|
|
||||||
$ SSID: sudo create_ap --list-running | sd '.+\((.+)\)' '$1'
|
|
||||||
|
|
||||||
% hotspot, create_ap, wifi, wihotspot
|
|
||||||
# Stop a running hotspot
|
|
||||||
sudo create_ap --stop <SSID>
|
|
||||||
$ SSID: sudo create_ap --list-running | sd '.+\((.+)\)' '$1'
|
|
||||||
|
|
||||||
% fish, for, loop
|
% fish, for, loop
|
||||||
# For-loop in fish shell
|
# For-loop in fish shell
|
||||||
for o in <objects>; <action>; end
|
for o in <objects>; <action>; end
|
||||||
|
|
||||||
|
% find
|
||||||
|
# Find files under a certain size in the current directory
|
||||||
|
find . -type f -name "<glob>" -size -<size>
|
||||||
|
|
||||||
|
; ===========================
|
||||||
|
; CODING
|
||||||
|
; ===========================
|
||||||
|
|
||||||
|
% objdump, disassemble
|
||||||
|
# Disassemble an object file
|
||||||
|
objdump -d -S -M intel "<file>" | bat -l nasm
|
||||||
|
$ file: eza -f -1
|
||||||
|
|
||||||
|
; ===========================
|
||||||
|
; DOCUMENTS
|
||||||
|
; ===========================
|
||||||
|
|
||||||
|
% pdftocairo, pdf, svg
|
||||||
|
# Extract svg figure from pdf page
|
||||||
|
pdftocairo -f <page> -l <page> -svg "<input>" "<output>"
|
||||||
|
$ input: eza -f -1
|
||||||
|
|
||||||
|
; ===========================
|
||||||
|
; YT-DLP
|
||||||
|
; ===========================
|
||||||
|
|
||||||
|
% yt-dlp, mp4
|
||||||
|
# Download mp4 video in best quality
|
||||||
|
yt-dlp -f 'bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b' --recode-video mp4 "<url>"
|
||||||
|
|
||||||
|
% yt-dlp, mp3
|
||||||
|
# Download mp3 video in best quality
|
||||||
|
yt-dlp -f 'ba' --extract-audio --audio-format mp3 "<url>"
|
||||||
|
|
||||||
|
; ===========================
|
||||||
|
; FFMPEG
|
||||||
|
; ===========================
|
||||||
|
|
||||||
|
% ffmpeg, slowmo
|
||||||
|
# Create a slow motion version of a video with interpolated/blended frames
|
||||||
|
ffmpeg -i "<input>" -filter:v "minterpolate='mi_mode=mci:mc_mode=aobmc:vsbmc=1:fps=<doublefps>',setpts=2*PTS" output.mp4
|
||||||
|
$ input: eza -f -1
|
||||||
|
|
||||||
|
% ffmpeg, cropdetect
|
||||||
|
# Detect black bar dimensions automatically by looking at the first 10 frames
|
||||||
|
ffmpeg -i "<input>" -vframes 10 -vf cropdetect -f null -
|
||||||
|
$ input: eza -f -1
|
||||||
|
|
||||||
|
% ffmpeg, cropdetect, preview
|
||||||
|
# Preview video with applied crop settings
|
||||||
|
ffplay -vf crop=<width>:<height>:<x>:<y> "<input>"
|
||||||
|
$ input: eza -f -1
|
||||||
|
|
||||||
|
% ffmpeg, cropdetect, render
|
||||||
|
# Re-encode the video with applied crop settings
|
||||||
|
ffmpeg -i "<input>" -vf crop=<width>:<height>:<x>:<y> -c:a copy output.mp4
|
||||||
|
$ input: eza -f -1
|
||||||
|
|
||||||
|
% ffmpeg, video compression, h265, render, reencode
|
||||||
|
# Reencode and compress the video using the h265 codec
|
||||||
|
ffmpeg -i "<input>" -vcodec libx265 -crf <quality> "out_<input>"
|
||||||
|
$ input: eza -f -1
|
||||||
|
$ quality: echo -e "24\n25\n26\n27\n28\n29\n30\n"
|
||||||
|
|
||||||
|
% ffmpeg, video compression, h256, render, reencode
|
||||||
|
# Reencode and compress multiple videos using the h265 codec
|
||||||
|
fish -c "for name in <files>; ffmpeg -i '$name' -vcodec libx265 -crf <quality> 'out_$name'; end"
|
||||||
|
$ quality: echo -e "24\n25\n26\n27\n28\n29\n30\n"
|
||||||
|
|||||||
@ -32,6 +32,12 @@ rec {
|
|||||||
];
|
];
|
||||||
|
|
||||||
# Enable and configure my custom HM modules.
|
# Enable and configure my custom HM modules.
|
||||||
|
paths = {
|
||||||
|
enable = true; # You can't disable this
|
||||||
|
nixflake = "${config.home.homeDirectory}/NixFlake";
|
||||||
|
dotfiles = "${config.home.homeDirectory}/NixFlake/config";
|
||||||
|
};
|
||||||
|
|
||||||
modules = {
|
modules = {
|
||||||
ags.enable = false; # TODO: Configure
|
ags.enable = false; # TODO: Configure
|
||||||
|
|
||||||
@ -238,7 +244,7 @@ rec {
|
|||||||
formatted;
|
formatted;
|
||||||
|
|
||||||
# TODO: If navi enabled
|
# TODO: If navi enabled
|
||||||
".local/share/navi/cheats/christoph.cheat".source = ../../config/navi/christoph.cheat; # TODO :Symlink
|
".local/share/navi/cheats/christoph.cheat".source = config.lib.file.mkOutOfStoreSymlink "${config.paths.dotfiles}/navi/christoph.cheat";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Here, custom scripts can be run when activating a HM generation.
|
# Here, custom scripts can be run when activating a HM generation.
|
||||||
@ -470,6 +476,90 @@ rec {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# TODO: Currently depends on nnn module. Create yazi module mirroring nnn module (deps etc.)
|
||||||
|
yazi = let
|
||||||
|
yazi-plugins = pkgs.fetchFromGitHub {
|
||||||
|
owner = "yazi-rs";
|
||||||
|
repo = "plugins";
|
||||||
|
rev = "5186af7984aa8cb0550358aefe751201d7a6b5a8"; # NOTE: Refresh after system updates depending on the yazi version
|
||||||
|
hash = "sha256-Cw5iMljJJkxOzAGjWGIlCa7gnItvBln60laFMf6PSPM=";
|
||||||
|
};
|
||||||
|
|
||||||
|
yazi-starship = pkgs.fetchFromGitHub {
|
||||||
|
owner = "Rolv-Apneseth";
|
||||||
|
repo = "starship.yazi";
|
||||||
|
rev = "6c639b474aabb17f5fecce18a4c97bf90b016512";
|
||||||
|
sha256 = "sha256-bhLUziCDnF4QDCyysRn7Az35RAy8ibZIVUzoPgyEO1A=";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
enable = true;
|
||||||
|
enableFishIntegration = true;
|
||||||
|
shellWrapperName = "y";
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
manager = {
|
||||||
|
show_hidden = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
preview = {
|
||||||
|
max_width = 1000;
|
||||||
|
max_height = 1000;
|
||||||
|
};
|
||||||
|
|
||||||
|
plugin.prepend_fetchers = [
|
||||||
|
{
|
||||||
|
id = "git";
|
||||||
|
name = "*";
|
||||||
|
run = "git";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
id = "git";
|
||||||
|
name = "*/";
|
||||||
|
run = "git";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
plugins = {
|
||||||
|
full-border = "${yazi-plugins}/full-border.yazi";
|
||||||
|
starship = "${yazi-starship}";
|
||||||
|
git = "${yazi-plugins}/git.yazi";
|
||||||
|
mount = "${yazi-plugins}/mount.yazi";
|
||||||
|
chmod = "${yazi-plugins}/chmod.yazi";
|
||||||
|
# toggle-pane = "${yazi-plugins}/toggle-pane.yazi";
|
||||||
|
};
|
||||||
|
|
||||||
|
initLua = ''
|
||||||
|
require("full-border"):setup()
|
||||||
|
require("starship"):setup()
|
||||||
|
require("git"):setup()
|
||||||
|
'';
|
||||||
|
|
||||||
|
keymap = {
|
||||||
|
input.prepend_keymap = [
|
||||||
|
{
|
||||||
|
# Don't exit vi mode on <Esc>, but close the input
|
||||||
|
on = "<Esc>";
|
||||||
|
run = "close";
|
||||||
|
desc = "Cancel input";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
manager.prepend_keymap = [
|
||||||
|
{
|
||||||
|
on = "M";
|
||||||
|
run = "plugin mount";
|
||||||
|
desc = "Manage device mounts";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
on = ["C"];
|
||||||
|
run = "plugin chmod";
|
||||||
|
desc = "Chmod on selected files";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
yt-dlp.enable = true;
|
yt-dlp.enable = true;
|
||||||
|
|
||||||
zoxide = {
|
zoxide = {
|
||||||
|
|||||||
@ -19,7 +19,7 @@ in {
|
|||||||
|
|
||||||
home.file = {
|
home.file = {
|
||||||
# NOTE: Keep this symlinked as long as I'm configuring
|
# NOTE: Keep this symlinked as long as I'm configuring
|
||||||
".config/ags".source = config.lib.file.mkOutOfStoreSymlink "/home/christoph/NixFlake/home/modules/ags/config";
|
".config/ags".source = config.lib.file.mkOutOfStoreSymlink "${config.paths.nixflake}/home/modules/ags/config";
|
||||||
|
|
||||||
# LSP typechecking support (use ags --init)
|
# LSP typechecking support (use ags --init)
|
||||||
# ".config/ags/types".source = config.lib.file.mkOutOfStoreSymlink "${pkgs.ags}/share/com.github.Aylur.ags/types";
|
# ".config/ags/types".source = config.lib.file.mkOutOfStoreSymlink "${pkgs.ags}/share/com.github.Aylur.ags/types";
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
./latex
|
./latex
|
||||||
./neovim
|
./neovim
|
||||||
./nnn
|
./nnn
|
||||||
|
./paths
|
||||||
./rofi
|
./rofi
|
||||||
./waybar
|
./waybar
|
||||||
./zathura
|
./zathura
|
||||||
|
|||||||
15
home/modules/paths/default.nix
Normal file
15
home/modules/paths/default.nix
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
nixosConfig,
|
||||||
|
lib,
|
||||||
|
mylib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (config) paths;
|
||||||
|
in {
|
||||||
|
# The paths module doesn't use the "modules" namespace to keep the access shorter
|
||||||
|
options.paths = import ./options.nix {inherit lib mylib;};
|
||||||
|
|
||||||
|
config = lib.mkIf paths.enable {};
|
||||||
|
}
|
||||||
23
home/modules/paths/options.nix
Normal file
23
home/modules/paths/options.nix
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
mylib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib;
|
||||||
|
with mylib.modules; {
|
||||||
|
enable = mkEnableOption "paths";
|
||||||
|
|
||||||
|
nixflake = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
apply = toString;
|
||||||
|
example = "${config.home.homeDirectory}/NixFlake";
|
||||||
|
description = "Location of the NixFlake working copy";
|
||||||
|
};
|
||||||
|
|
||||||
|
dotfiles = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
apply = toString;
|
||||||
|
example = "${config.home.homeDirectory}/NixFlake/config";
|
||||||
|
description = "Location of the NixFlake working copy's config directory";
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -68,7 +68,7 @@ in {
|
|||||||
networking = {
|
networking = {
|
||||||
# Gets inherited from flake in nixos mylib and passed through the module option
|
# Gets inherited from flake in nixos mylib and passed through the module option
|
||||||
hostName = cfg.hostname; # Define your hostname.
|
hostName = cfg.hostname; # Define your hostname.
|
||||||
enableIPv6 = false;
|
enableIPv6 = true;
|
||||||
|
|
||||||
# Disable a lot of stuff not needed for systemd-networkd
|
# Disable a lot of stuff not needed for systemd-networkd
|
||||||
networkmanager.enable = false;
|
networkmanager.enable = false;
|
||||||
|
|||||||
@ -16,11 +16,18 @@
|
|||||||
# This should override the default network 50-ether
|
# This should override the default network 50-ether
|
||||||
"10-ether-2_5G" = mylib.networking.mkStaticSystemdNetwork {
|
"10-ether-2_5G" = mylib.networking.mkStaticSystemdNetwork {
|
||||||
interface = "enp8s0";
|
interface = "enp8s0";
|
||||||
ip = ["192.168.86.50/24"];
|
ip = ["192.168.86.50/24" "fd00::32/120"];
|
||||||
router = ["192.168.86.5"];
|
router = ["192.168.86.5" "fd00::5"];
|
||||||
nameserver = ["192.168.86.26"];
|
nameserver = ["192.168.86.26" "fd00::1a"];
|
||||||
routable = true;
|
routable = true;
|
||||||
};
|
};
|
||||||
|
"10-ether-1G" = mylib.networking.mkStaticSystemdNetwork {
|
||||||
|
interface = "enp5s0";
|
||||||
|
ip = ["192.168.86.50/24" "fd00::32/120"];
|
||||||
|
router = ["192.168.86.5" "fd00::5"];
|
||||||
|
nameserver = ["192.168.86.26" "fd00::1a"];
|
||||||
|
routable = false;
|
||||||
|
};
|
||||||
# "10-ether-1G" = mylib.networking.mkStaticSystemdNetwork {...};
|
# "10-ether-1G" = mylib.networking.mkStaticSystemdNetwork {...};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -54,8 +54,10 @@
|
|||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
# still possible to use this option, but it's recommended to use it in conjunction
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||||
|
|
||||||
networking.useDHCP = lib.mkDefault false; # NOTE: Set to false bc systemd-networkd
|
networking.useDHCP = lib.mkDefault false; # NOTE: Set to false bc systemd-networkd
|
||||||
networking.enableIPv6 = false;
|
networking.enableIPv6 = lib.mkDefault false; # NOTE: Could be overwritten by systemd-networkd
|
||||||
|
|
||||||
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
|
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
|
||||||
# networking.interfaces.enp4s0u2.useDHCP = lib.mkDefault true;
|
# networking.interfaces.enp4s0u2.useDHCP = lib.mkDefault true;
|
||||||
# networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
|
# networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
|
||||||
|
|||||||
Reference in New Issue
Block a user