Skip to content

Instantly share code, notes, and snippets.

View drewbrokke's full-sized avatar
🦆
work work work

Drew Brokke drewbrokke

🦆
work work work
View GitHub Profile
@drewbrokke
drewbrokke / use_gnu_utils_on_mac.sh
Last active October 3, 2024 17:14
Using the GNU Utils for MacOS in a shell script
#!/bin/bash
# First install the GNU utils with Homebrew
# Reference this article: https://apple.stackexchange.com/questions/69223/how-to-replace-mac-os-x-utilities-with-gnu-core-utilities
# They can actually configured to replace the built-in tools without a prefix, but we don't need to require that just for bundlebuster
# This is the command from the SO answer:
# brew install coreutils findutils gnu-tar gnu-sed gawk gnutls gnu-indent gnu-getopt grep
# echo g-prefixed command if found, otherwise use base command
@drewbrokke
drewbrokke / pluginInfo-task.gradle
Last active August 11, 2023 23:28 — forked from gamerson/pluginInfo-task.gradle
Script to print info for all plugins applied to a given project
import java.nio.file.FileSystem
import java.nio.file.FileSystems
import java.nio.file.FileVisitResult
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import java.nio.file.SimpleFileVisitor
import java.nio.file.attribute.BasicFileAttributes
allprojects {
#!/bin/bash
function detect_unused_paths() {
local file
file="$1"
base_file_name="$(basename "${file%%.path}")"
for i in $(rg '<td>([A-Z_]+)</td>' --replace='$1' --no-line-number --no-filename --no-heading --only-matching -- "${file}") ; do
git --no-pager grep --quiet "\"${base_file_name}#${i}\"" -- '*.macro' '*.function' '*.testcase' || echo "${base_file_name}#${i}"
document.querySelectorAll('input[type="checkbox"][value="indeterminate"]') .forEach(function(checkbox) {
checkbox.indeterminate = true;
let onchangeHandler = function() {
checkbox.value = '';
checkbox.removeEventListener('change', onchangeHandler);
}
checkbox.addEventListener('change', onchangeHandler);
});
#!/bin/bash
# openFiles // opens all files between current branch and master
# openFiles branchName // opens all files between "branchName" and master
# openFiles commitHash // opens all files between "commitHash" and master
# openFiles commitHash1 commitHash2 // opens all files between "commitHash1" and "commitHash2"
function openFiles() {
HASH1="${1}"
#!/bin/bash
check_dependency fzf gsed pup || exit
DELIMITER=" : "
function getUsers() {
URL="${1}"
MARKUP="$(curl -s "https://github.com${URL}")"
#!/bin/bash
error() {
echo "$1" && exit 1
}
while getopts "k:s:t:" FLAGS; do
case $FLAGS in
k) KEYS="${OPTARG}" ;;
s) SOURCE_DIRECTORY="${OPTARG}" ;;
compile-common-jsp:
[java] Changes to environment variables are ignored when same JVM is used.
[echo] Mar 08, 2021 11:38:55 AM org.apache.jasper.servlet.TldScanner scanJars
[echo] INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
[echo] Mar 08, 2021 11:38:56 AM org.apache.jasper.JspC execute
[echo] INFO: Generation completed with [0] errors in [1406] milliseconds
[javac] Compiling 218 source files to /Users/drewbrokke/Documents/liferay/liferay-portal/portal-web/classes/tomcat
[javac] /Users/drewbrokke/Documents/liferay/liferay-portal/portal-web/classes/tomcat/org/apache/jsp/WEB_002dINF/jsp/_005fservlet_005fcontext_005finclude_jsp.java:10: error: package javax.servlet does not exist
[javac] import javax.servlet.*;
[javac] ^
#!/bin/bash
# "sog" stands for "Show On Github"
if [ $# -lt 1 ]
then
echo "Show On Github"
echo "Enter a grep search term. Any matching paths will be opened on Github if possible."
exit
fi
@drewbrokke
drewbrokke / gh_pr_fuzzy
Last active November 2, 2020 17:00
Passes `gh` pull data to an interactive `fzf` instance
#!/bin/bash
# check_dependency fzf gh jq || exit 1
DEFAULT_USER="$(git config user.name)"
REPO_NAME="$(git rev-parse --show-toplevel | xargs basename)"
USER="${1:-${DEFAULT_USER}}"
PULLS_JSON="$(gh api "/repos/${USER}/${REPO_NAME}/pulls")"