fixup
This commit is contained in:
parent
d871ef787e
commit
1ff6364827
4 changed files with 83 additions and 13 deletions
44
home/config/nushell/scripts/media-downloader.nu
Normal file
44
home/config/nushell/scripts/media-downloader.nu
Normal 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
|
||||
}
|
|
@ -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)
|
||||
|
||||
match $os {
|
||||
"Darwin" => { echo "D1" }
|
||||
"Linux" => { echo D2 }
|
||||
"Darwin" => { ~/.config/nixpkgs/home/programs/nvim/update-plugins.sh }
|
||||
"Linux" => { /etc/nixos/home/programs/nvim/update-plugins.sh }
|
||||
_ => { 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
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ let
|
|||
in
|
||||
{
|
||||
|
||||
home.packages = with pkgs; [ ] ++ optionals isDarwin [
|
||||
home.packages = with pkgs; optionals isDarwin [
|
||||
terminal-notifier
|
||||
];
|
||||
|
||||
|
|
|
@ -1,28 +1,31 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.nushell = {
|
||||
enable = true;
|
||||
|
||||
shellAliases = {
|
||||
nrsw = "nixpkgs-switch";
|
||||
upa = "nix flake update ~/.config/nixpkgs -v and upn";
|
||||
ngc = "nix-collect-garbage -d and sudo nix-collect-garbage -d";
|
||||
upa = "update-all";
|
||||
ngc = "nix-garbage-collect";
|
||||
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 = {
|
||||
text = ''
|
||||
$env.config = {
|
||||
show_banner: false
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue