Skip to content

Instantly share code, notes, and snippets.

View TitusRobyK's full-sized avatar
🏠
Working from home

Titus Roby K TitusRobyK

🏠
Working from home
View GitHub Profile
import org.apache.sling.api.resource.Resource
import org.apache.sling.api.resource.ResourceResolver
import org.apache.sling.api.resource.ValueMap
def rootPath = "/content/wknd/us/en"
Resource root = resourceResolver.getResource(rootPath)
if (root == null) {
println "ERROR: Path not found: ${rootPath}"
@TitusRobyK
TitusRobyK / cascadeAndCherryPick.sh
Created April 25, 2025 17:11
Move changes from one branch to another
#!/bin/bash
# --- Configuration ---
RELEASE_BASE_BRANCH="release/1.1.0"
DEVELOP_BRANCH="develop"
REMOTE_NAME="azure"
# --- Script Logic ---
echo "--- Starting Change Cascade Script ---"
Count the Commits: Determine how many commits you want to squash (say 5).
Start Interactive Rebase:
Run the following command (replace 5 with the number of commits):
git rebase -i HEAD~5
Mark Commits for Squashing:
An editor will open listing your commits. Keep the first commit as pick and change the rest from pick to squash (or s):
pick abc123 First commit message
#!/bin/bash
# setup.sh - Installs Homebrew, Java 11, Maven, nvm, and Node.js (LTS) on macOS (Apple Silicon)
# This script checks for existing installations and environment variable setups before proceeding.
#
# Usage:
# chmod +x setup.sh
# ./setup.sh
# or bash setup.sh
set -e # Exit on error
@TitusRobyK
TitusRobyK / Open In VSCode.txt
Last active August 25, 2024 22:23
To enable the option to open a folder directly in Visual Studio Code from Finder with a right-click
1) Open the Automator app on your Mac.
2) Choose New Document and select Quick Action
3) In the top section of the Automator window, ensure the following settings:
Workflow receives current: files or folders
in: Finder
4) In the search bar, type "Run AppleScript" and drag the action to the workflow area.
5) Use the following AppleScript code:
on run {input, parameters}
repeat with i in input
@TitusRobyK
TitusRobyK / init.lua
Last active June 3, 2024 21:13
This Hammerspoon script automates periodic keystroke simulation within a specified application ("Citrix Viewer") to prevent it from logging out due to inactivity. The script is designed with robust logging and error handling to ensure reliability and ease of debugging. Additionally, it reloads the Hammerspoon configuration after a set number of …
-- Overview:
-- This Hammerspoon script is designed to prevent the Citrix Viewer application from logging out due to inactivity.
-- It simulates user keystrokes periodically to keep the session active.
-- The script performs the following tasks:
-- 1. Configures Hammerspoon to use Spotlight for application name searches.
-- 2. Clears the console and logs the initiation of a fresh session.
-- 3. Defines constants for the application name, time interval between keystrokes, and session limit for reload.
-- 4. Implements a logging function that timestamps messages for better traceability.
-- 5. Implements a function to simulate keystrokes (right arrow and 'h') in the Citrix Viewer application.
-- 6. Implements a function to reload Hammerspoon configuration.
##1 Performs a Wikipedia search on any highlighted text in the web browser window
javascript: (function() {
function se(d) {
return d.selection ? d.selection.createRange().text : d.getSelection()
}
var s = se(document);
for (var i = 0; i < frames.length && (s == null || s == ''); i++) s = se(frames[i].document);
if (!s || s == '') s = prompt('Enter%20search%20terms%20for%20Wikipedia', '');
open('https://en.wikipedia.org' + (s ? '/w/index.php?title=Special:Search&search=' + encodeURIComponent(s) : '')).focus();
@TitusRobyK
TitusRobyK / nvmCommands.js
Created February 26, 2024 01:48 — forked from chranderson/nvmCommands.js
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
#!/bin/bash
# This script is a comprehensive Bash script that automates the process of installing FFmpeg (if not already installed),
# then recursively searches through a directory and its subdirectories for .mov files.
# For each .mov file found, it uses FFmpeg to convert the file into a compressed .mp4 format,
# aiming to significantly reduce the file size with minimal loss in quality.
# Function to install ffmpeg
install_ffmpeg() {
@TitusRobyK
TitusRobyK / createPackage.groovy
Created May 5, 2023 23:35
Create a AEM CRX Package using Groovy for a list of paths
/*
In the Data Section , add the paths as shown below
/content/abc
/content/xyz
/content/qwerty/mno/pwse
Upon execution of the following code , This would create a package called "Sample-Package" with the above paths as filters.
*/