This commit is contained in:
Kopatz
2025-10-21 17:47:05 +02:00
parent e440985c34
commit 6e7cda47e4
6 changed files with 70 additions and 3 deletions

View File

@@ -27,8 +27,9 @@ nnoremap <leader>t :action Terminal.OpenInTerminal<CR>
nnoremap <leader>q :action QuickJavaDoc<CR> nnoremap <leader>q :action QuickJavaDoc<CR>
nnoremap <leader>f :action Find<CR> nnoremap <leader>f :action Find<CR>
nnoremap <leader>r :action Replace<CR> nnoremap <leader>r :action Replace<CR>
map f <Plug>(easymotion-bd-f) " broken in latest version of idea vim?
map <leader>f <Plug>(easymotion-bd-w) "map f <Plug>(easymotion-bd-f)
"map <leader>f <Plug>(easymotion-bd-w)
nnoremap J mzJ`z nnoremap J mzJ`z
nnoremap S ht lr<cr>k$ nnoremap S ht lr<cr>k$

View File

@@ -373,6 +373,7 @@ in
path = "/synced/fh/master/ot_fundamentals_and_security/merged"; path = "/synced/fh/master/ot_fundamentals_and_security/merged";
node = "${pkgs.nodejs}/bin/node"; node = "${pkgs.nodejs}/bin/node";
set-monitor = "~/.config/hypr/monitor-config.js"; set-monitor = "~/.config/hypr/monitor-config.js";
answer = "${pkgs.answer}/bin/answer";
in in
'' ''
bind = $mainMod, A, submap, notes bind = $mainMod, A, submap, notes
@@ -392,7 +393,7 @@ in
bind = $mainMod, N, exec, ${dunstify} "$(${wl-paste})" bind = $mainMod, N, exec, ${dunstify} "$(${wl-paste})"
bind = $mainMod, D, exec, ${dunstctl} close-all bind = $mainMod, D, exec, ${dunstctl} close-all
## I win ## I win
#bind = $mainMod, W, exec, ${wl-paste} | sgpt --model="gpt-4o" "Respond with the correct answer to the following question." | ${wl-copy} bind = $mainMod, W, exec, ${wl-paste} | ${answer} "Respond with the correct answer to the following question." | ${wl-copy} && ${dunstify} -t 150 Done
## notes ## notes
#bind = $mainMod, 2, exec, cat ~/Nextcloud/test.txt | ${wl-copy} #bind = $mainMod, 2, exec, cat ~/Nextcloud/test.txt | ${wl-copy}

View File

@@ -93,6 +93,7 @@ in {
compsize compsize
trashy # move files to trash trashy # move files to trash
#shell-gpt #openai bitches stole my credits :( #shell-gpt #openai bitches stole my credits :(
answer
libheif # convert heic to jpg with `heif-convert something.heic something.jpg` libheif # convert heic to jpg with `heif-convert something.heic something.jpg`
imagemagick # convert images imagemagick # convert images
tree tree

13
pkgs/answer/default.nix Normal file
View File

@@ -0,0 +1,13 @@
{ stdenv, nodejs, ... }:
stdenv.mkDerivation rec {
pname = "answer";
version = "1.0";
src = ./src;
nativeBuildInputs = [ nodejs ];
installPhase = ''
mkdir -p $out/bin
cp $src/answer.js $out/bin/answer
chmod +x $out/bin/answer
'';
}

50
pkgs/answer/src/answer.js Executable file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/env node
async function promptGpt(message) {
let body = JSON.stringify({
model: "openai",
stream: false,
temperature: 1,
top_p: 1,
messages: [
{ role: "system", content: "Your are a helpful assistant that provides brief responses unless asked for more details." },
{ role: "user", content: message }
]
})
let response = await fetch('https://text.pollinations.ai/openai', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
let data = await response.json();
return data.choices[0].message.content;
}
async function trick17(args) {
const getStdin = async () => {
const chunks = [];
for await (const chunk of process.stdin) chunks.push(chunk);
return Buffer.concat(chunks).toString();
};
let stdin = await getStdin();
//console.log("Received stdin:", stdin);
console.log(await promptGpt(`${args.join(' ')}\n${stdin}`));
}
async function main() {
let args = process.argv.slice(2);
if (args.length === 0) {
console.log("No arguments provided. Exiting.");
return;
}
trick17(args);
}
await main();

View File

@@ -18,4 +18,5 @@
hollow-grub = pkgs.callPackage ./hollow-grub/default.nix { }; hollow-grub = pkgs.callPackage ./hollow-grub/default.nix { };
peframe = pkgs.callPackage ./peframe/default.nix { python3Packages = pkgs.python3Packages; inherit virustotal-api; }; peframe = pkgs.callPackage ./peframe/default.nix { python3Packages = pkgs.python3Packages; inherit virustotal-api; };
virustotal-api = pkgs.callPackage ./virustotal-api/default.nix { python3Packages = pkgs.python3Packages; }; virustotal-api = pkgs.callPackage ./virustotal-api/default.nix { python3Packages = pkgs.python3Packages; };
answer = pkgs.callPackage ./answer/default.nix { };
} }