diff --git a/apps/apps.nix b/apps/apps.nix index 53b396c..d992283 100644 --- a/apps/apps.nix +++ b/apps/apps.nix @@ -217,6 +217,8 @@ in { end abbr -a --position anywhere CC --function copy_clipboard + + abbr -a --position command ttlfix TTLfix ''; }; diff --git a/apps/scripts.nix b/apps/scripts.nix index 8362148..79b466e 100644 --- a/apps/scripts.nix +++ b/apps/scripts.nix @@ -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 ]; } \ No newline at end of file diff --git a/derivations/fish/fish-functions.nix b/derivations/fish/fish-functions.nix index 007ec3d..1660ead 100644 --- a/derivations/fish/fish-functions.nix +++ b/derivations/fish/fish-functions.nix @@ -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"; diff --git a/derivations/fish/fish-functions/functions/edit-remote.fish b/derivations/fish/fish-functions/functions/edit-remote.fish new file mode 100644 index 0000000..7b9eb42 --- /dev/null +++ b/derivations/fish/fish-functions/functions/edit-remote.fish @@ -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 diff --git a/derivations/fish/fish-functions/functions/icat_auto.fish b/derivations/fish/fish-functions/functions/icatfit.fish similarity index 87% rename from derivations/fish/fish-functions/functions/icat_auto.fish rename to derivations/fish/fish-functions/functions/icatfit.fish index fe4c57b..d69204e 100644 --- a/derivations/fish/fish-functions/functions/icat_auto.fish +++ b/derivations/fish/fish-functions/functions/icatfit.fish @@ -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