Skip to content

Instantly share code, notes, and snippets.

View Steveorevo's full-sized avatar

Stephen J. Carnam Steveorevo

View GitHub Profile
@Steveorevo
Steveorevo / linear_strings.php
Last active February 9, 2023 19:12
Linear version of GStrings' most used parsing methods
<?php
/**
* Deletes the right most string from the found search string
* starting from right to left, including the search string itself.
*
* @return string
*/
function delRightMost( $sSource, $sSearch ) {
for ( $i = strlen( $sSource ); $i >= 0; $i = $i - 1 ) {
$f = strpos( $sSource, $sSearch, $i );
@Steveorevo
Steveorevo / abcopy
Created September 24, 2023 06:20
Copies a source folder to the destination via rsync -an and fixes *absolute* links. Normally rsync only handles *relative* symbolic. This script searches for absolute links with destinations that are within the source folder and updates them to reflect the destination copy.
#!/bin/bash
#
# Copies a source folder to the destination folder via `rsync -a` and
# fixes *absolute* links. Normally rsync only handles *relative* links
# and preserves absolute links. This script searches for the copied
# absolute links in the destination that are pointing to the original
# source folder and updates them to reflect the new destination copy.
#
# Author: Stephen J. Carnam
# Copyright (c) 2023 Virtuosoft / Stephen J. Carnam
@Steveorevo
Steveorevo / benchmark
Created March 15, 2025 06:17
Benchmark CLI app, tells you how long a command ran
#!/bin/bash
#
# @author Stephen J. Carnam
# @license GNU GENERAL PUBLIC LICENSE Version 2
# @link https://steveorevo.com
#
# Check if a command is provided
if [ -z "$1" ]; then
echo "Usage: benchmark <command>"
@Steveorevo
Steveorevo / LegacyRubyIssue.txt
Created July 12, 2025 18:33
LegacyRubyIssue
connby@connby2:~$ # 1. Ensure rbenv is set to Ruby 2.2.4
rbenv global 2.2.4
ruby -v # Verify this outputs "ruby 2.2.4p..."
# 2. Remove all currently installed gems for Ruby 2.2.4
# This cleans the entire gem environment for this specific Ruby version
rm -rf "/home/connby/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0"
# 3. Also remove any potentially partial bundler executables
rm -f "/home/connby/.rbenv/versions/2.2.4/bin/bundle"