edit-remote.fish + small fish edits + TTLfix

This commit is contained in:
Your Name 2024-04-29 01:21:59 +03:00
parent 731e98d56e
commit f9cfbb8dc6
5 changed files with 41 additions and 2 deletions

View file

@ -217,6 +217,8 @@ in {
end
abbr -a --position anywhere CC --function copy_clipboard
abbr -a --position command ttlfix TTLfix
'';
};

View file

@ -148,6 +148,13 @@ let
icon = "firefox-developer-edition";
exec = "firefox-russia";
};
TTLfix = pkgs.writeScriptBin "TTLfix" ''
#!/${pkgs.bash}/bin/bash
sudo sysctl -w net.ipv4.ip_default_ttl=64
sudo sysctl -w net.ipv6.conf.all.hop_limit=65
sudo sysctl -w net.ipv6.conf.default.hop_limit=65
'';
in {
users.users.delta.packages = [
kitty_wrapped
@ -156,5 +163,6 @@ in {
autostart autostartDesktopItem
firefoxRussia firefoxRussiaDesktopItem
# googleChromeRussia googleChromeRussiaDesktopItem
TTLfix
];
}

View file

@ -4,7 +4,7 @@ buildFishPlugin rec {
pname = "my-fish-functions";
version = "1.0.0";
src = ./fish-functions; # use local directory
src = ./fish-functions;
meta = with stdenv.lib; {
description = "My custom fish functions";

View file

@ -0,0 +1,29 @@
function edit-remote
set remote_file $argv[1]
set local_file /tmp/(basename $remote_file)
# Download the file
scp $remote_file $local_file
# Store the initial checksum of the file
set initial_checksum (md5sum $local_file | awk '{print $1}')
# Open the file in Helix
hx $local_file
# Calculate the checksum of the file after editing
set final_checksum (md5sum $local_file | awk '{print $1}')
# If the file was changed, upload it back to the remote server
if test $initial_checksum != $final_checksum
if scp $local_file $remote_file
echo "File uploaded successfully."
# If the upload was successful, delete the local file
rm $local_file
else
echo "File upload failed."
end
else
echo "File not changed."
end
end

View file

@ -1,4 +1,4 @@
function icat_auto
function icatfit
set cols (math (tput cols) - 1)
set lines (math (tput lines) - 1)
kitty +kitten icat --place $cols"x"$lines"@0x0" $argv