Skip to content

Instantly share code, notes, and snippets.

View rkmax's full-sized avatar

Julian Reyes Escrigas rkmax

View GitHub Profile
@rkmax
rkmax / translate.ts
Last active November 1, 2024 14:39
Clipboard Translator using OpenAI API This Deno script translates text from your clipboard using OpenAI's API and copies the result back to your clipboard
#!/usr/bin/env -S deno run --allow-net --allow-env --allow-run --allow-read --allow-write
import { copy, paste } from "https://deno.land/x/[email protected]/mod.ts";
import { config } from "https://deno.land/x/[email protected]/mod.ts";
// Load environment variables
config({ export: true });
const DEFAULT_SYSTEM = "Translate any user input into English, in an informal and concise way.";
const DEFAULT_MODEL = "gpt-4o-mini";
#!/bin/zsh
#
# Translate clipboard text using OpenAI's GPT-4 model.
# Requires OpenAI API key.
# Requires xclip (X11) or wl-clipboard (Wayland) to access clipboard.
# Requires jq, curl, sed.
default_system="Translate any user input into English, informal and concise."
get_content_from_clipboard() {
@rkmax
rkmax / gpt.zsh
Created October 21, 2024 14:38
#!/bin/zsh
gpt() {
if [[ ! $+commands[curl] ]]; then
echo "Curl must be installed."
return 1
fi
if [[ ! $+commands[jq] ]]; then
echo "Jq must be installed."
return 1
#!/usr/bin/env bash
#
# rofi-vscode.sh - A script to open recent files, folders and workspaces in VS Code.
# requires: rofi, jq, sqlite3
#
# Usage:
# rofi -modi "VSCode:rofi-vscode.sh" -show VSCode
#
vscdb_path="$HOME/.config/Code/User/globalStorage/state.vscdb"
/**
* rofi -dump-theme output.
* Rofi version: 1.7.5
**/
* {
text-color: var(fg0);
padding: 0;
fg2: rgba ( 222, 222, 222, 50 % );
bg2: rgba ( 8, 96, 242, 90 % );
fg1: White;
configuration {
/* modes: "window,drun,run,ssh";*/
font: "Source Code Pro Semi-Bold 14";
/* location: 0;*/
/* yoffset: 0;*/
/* xoffset: 0;*/
/* fixed-num-lines: true;*/
show-icons: true;
terminal: "kitty";
/* ssh-client: "ssh";*/
@rkmax
rkmax / record.sh
Created August 27, 2024 00:16
A Bash script for screen recording, daemon mode, and customizable frame rate and duration.
#!/bin/bash
output_dir="$HOME/Videos/Replays"
rate=30
pipe_path="/tmp/record_control_pipe"
pid_file="/tmp/record_screen.pid"
daemon_pid_file="/tmp/record_screen_daemon.pid"
daemon_log_file="/tmp/record_screen_daemon.log"
record_extension="mp4"
timeout=60
@rkmax
rkmax / migrate_from_exist_hitory.sh
Created January 27, 2024 21:03 — forked from exdeniz/migrate_from_exist_hitory.sh
Remove Duplicate zsh History
cat -n .zsh_history | sort -t ';' -uk2 | sort -nk1 | cut -f2- > .zhistory
@rkmax
rkmax / omnivore.sh
Created January 25, 2024 18:41
Helper script to save a URL to Omnivore.app
#!/usr/bin/env bash
#
# Helper script to save a URL to Omnivore
#
set -e
if [ -f $HOME/.omnivore ]; then
source $HOME/.omnivore
fi
#!/usr/bin/env python
import subprocess
import sys
SCREEN_LAYOUT = {
'horizontal': {
'full-size': '0,0,{width},{height}',
'half-left': '0,0,{width}/2,{height}',
'half-right': '{width}/2,0,{width}/2,{height}',