Skip to content

Instantly share code, notes, and snippets.

Prepending Messages to ChatGPT Prompts with JavaScript

This article explains a simple JavaScript snippet that automatically prepends a fixed message to the ChatGPT prompt input field. The goal is to enforce a consistent instruction—such as asking ChatGPT to always generate Git commit messages in English—without manually typing it every time.


How the Script Works

The script is wrapped in an Immediately Invoked Function Expression (IIFE) so it runs as soon as it is loaded. Inside, it follows these steps:

Wake-on-LAN Script with YAML Configuration, Interface Control, and Flexible Options: It has been moved to aont/wakeonlan-python.

Launching a Process on P-Cores Only in Windows

This Python script is designed to run a given program on Performance Cores (P-cores) of a modern CPU in a Windows environment. It uses Windows API functions through the ctypes library to interact with low-level system features.


1. Getting CPU Information

The first part of the script calls the Windows API function GetLogicalProcessorInformationEx to retrieve details about the system’s logical processors.

Copying to the Clipboard with OSC52 in Bash

Copying text from a remote shell to your local clipboard can be tricky. Luckily, many terminals support OSC52, an escape sequence that lets you send data straight to the clipboard. Here’s a handy Bash function you can drop into your ~/.bashrc:

osc52() {
  local data
  data=$(openssl base64 | tr -d '\n')
  printf "\e]52;c;%s\a" "$data"
}

Automatically Copying Killed Text to the System Clipboard via OSC52 in Emacs

Working inside a terminal often comes with one annoyance: copying text between your terminal-based editor and the system clipboard is not seamless. Fortunately, OSC52—a terminal escape sequence—provides a way to copy text from terminal applications (like Emacs running in a terminal) to the system clipboard.

This guide shows how to make Emacs automatically send killed text (copied or cut with M-w or C-w) to the system clipboard via OSC52.


What is OSC52?

Enabling OSC52 Clipboard Support in tmux

If you want to copy text from tmux into your system clipboard using OSC52, you can enable it with a simple configuration change.

Step 1: Update .tmux.conf

Add the following line to your ~/.tmux.conf:

set-option -g set-clipboard on

Keeping Rocky Linux 9 Up to Date with dnf-automatic

Keeping your system updated is one of the most important steps to ensure security, stability, and performance. On Rocky Linux 9.6, you can automate updates using the dnf-automatic package, which integrates seamlessly with the dnf package manager. This guide walks you through installation, configuration, and enabling automated updates.


1. Install dnf-automatic

The dnf-automatic tool is not installed by default. To add it, run:

How to Change Kernel Boot Parameters in GRUB on Linux

When troubleshooting or customizing your Linux system, you may need to adjust kernel boot parameters. One common case is switching from the default quiet boot to a verbose boot, which displays detailed system messages during startup. This guide explains how to make this change by editing the GRUB configuration.


Step 1: Open the GRUB Configuration File

The GRUB settings are stored in /etc/default/grub. Open this file with a text editor such as nano or vim using root privileges: