1
0
Fork 0
This commit is contained in:
Daniel Kempkens 2023-09-10 17:36:32 +02:00
parent d871ef787e
commit 1ff6364827
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
4 changed files with 83 additions and 13 deletions

View file

@ -0,0 +1,44 @@
export def instagram-dl [name: string url: string] {
print $"== ($name)"
let sleep = (random integer 11..15)
let sleep_req = (random integer 10..13)
let gdl_cookies = $"($env.HOME)/Pictures/Instagram/instagram.com_cookies.txt"
(gallery-dl
--directory $"($env.HOME)/Pictures/Instagram/($name)/"
--download-archive $"($env.HOME)/Pictures/Instagram/($name)/.archive"
--filename '{username}-{date:%Y-%m-%d}-{sidecar_media_id:?/_/}{media_id}.{extension}'
--config $"($env.HOME)/Pictures/Instagram/gallery-dl-generic.conf"
--cookies $gdl_cookies
--sleep $sleep
--sleep-request $sleep_req
--sleep-extractor $sleep_req
-vv
$url)
}
def bdfr-browser-import [] {
http post https://bdfr.internal.kempkens.network/_import_changes ''
}
export def bdfr [
--limit (-L): int = 10
--sort (-S): string = "hot"
] {
ssh -t mediaserver bdfr -L $limit -S $sort --authenticate
bdfr-browser-import
}
export def bdfr-subreddit [
$subreddit: string
--sort (-S): string = "hot"
] {
ssh -t mediaserver bdfr-raw -s $subreddit -S $sort --authenticate
bdfr-browser-import
}
export def bdfr-user [$user: string] {
ssh -t mediaserver bdfr-raw --user $user --submitted --all-comments --comment-context --authenticate
bdfr-browser-import
}

View file

@ -1,9 +1,32 @@
def upn [] { export alias update-system-flake = nix flake update ~/.config/nixpkgs -v
export def update-project-flake [] {
let envrc = (rg --no-line-number --color never '^use flake' ./.envrc)
if (not ('./.envrc' | path exists)) or $envrc =~ "^use flake$" {
nix flake update ./ -v
} else {
let flake_path = ($envrc | split column ' ' | get 0 | get column3)
nix flake update $flake_path -v
}
}
export def update-neovim-plugins [] {
let os = (uname) let os = (uname)
match $os { match $os {
"Darwin" => { echo "D1" } "Darwin" => { ~/.config/nixpkgs/home/programs/nvim/update-plugins.sh }
"Linux" => { echo D2 } "Linux" => { /etc/nixos/home/programs/nvim/update-plugins.sh }
_ => { error make {msg: "unsupported operating system"} } _ => { error make {msg: "unsupported operating system"} }
} }
} }
export def update-all [] {
update-system-flake
update-neovim-plugins
}
export def nix-garbage-collect [] {
nix-collect-garbage -d
sudo nix-collect-garbage -d
}

View file

@ -7,7 +7,7 @@ let
in in
{ {
home.packages = with pkgs; [ ] ++ optionals isDarwin [ home.packages = with pkgs; optionals isDarwin [
terminal-notifier terminal-notifier
]; ];

View file

@ -1,28 +1,31 @@
{ pkgs, ... }:
{ {
programs.nushell = { programs.nushell = {
enable = true; enable = true;
shellAliases = { shellAliases = {
nrsw = "nixpkgs-switch"; nrsw = "nixpkgs-switch";
upa = "nix flake update ~/.config/nixpkgs -v and upn"; upa = "update-all";
ngc = "nix-collect-garbage -d and sudo nix-collect-garbage -d"; ngc = "nix-garbage-collect";
nsr = "sudo nix-store --verify --check-contents --repair"; nsr = "sudo nix-store --verify --check-contents --repair";
la = "${pkgs.eza}/bin/eza --long --all --group --header --group-directories-first --sort=type --icons";
lg = "${pkgs.eza}/bin/eza --long --all --group --header --git";
lt = "${pkgs.eza}/bin/eza --long --all --group --header --tree --level ";
}; };
configFile = { configFile = {
text = '' text = ''
$env.config = { $env.config = {
show_banner: false show_banner: false
keybindings: [] keybindings: []
} }
$env.PATH = ($env.PATH |split row ":"| append $"($env.HOME)/.bin")
use ~/.config/nushell/scripts/nix-utils.nu *
use ~/.config/nushell/scripts/media-downloader.nu *
''; '';
}; };
}; };
xdg.configFile."nushell/scripts" = {
source = ../config/nushell/scripts;
recursive = true;
};
} }