Skip to content

Instantly share code, notes, and snippets.

View ctubbsii's full-sized avatar
๐Ÿ”’
โ€

Christopher Tubbs ctubbsii

๐Ÿ”’
โ€
View GitHub Profile
@ctubbsii
ctubbsii / pygithub-example.py
Created July 3, 2024 19:16
A simple example of using pygithub to list repos for cloning with an OAuth2 token
#! /usr/bin/python3
# This script is a very basic example of how to list repos using pygithub and
# clone them with an OAuth2 token. Ideally, you'd retrieve the token from a
# secure keystore using something like libsecret, rather than hard-code it into
# the script, and you'd clone using a method that prevents the token from being
# stored in your shell history for security, but this is just an example.
# tested with python3-pygithub-1.58.2-5.fc40.noarch
# docs at https://pygithub.readthedocs.io/
@ctubbsii
ctubbsii / update-maven.sh
Last active June 18, 2024 23:35
A simple tool to download and use the latest Maven version
#! /usr/bin/bash
set -e
cd "$(dirname "$0")"
# check if running in a color terminal
terminalSupportsColor() {
local c
c=$(tput colors 2>/dev/null) || c=-1
@ctubbsii
ctubbsii / git-diffTests
Created April 26, 2022 18:17
git-diffTests : create a Maven command line with -Dtest= and -Dit.test= for changed tests
#! /usr/bin/bash
function findTests() {
{
echo 'blah'
git diff --name-only "$2" | grep "$1[.]java" | xargs -n1 basename 2>/dev/null | cut -f1 -d.
} | paste -sd,
}
if [[ -z $1 ]]; then
@ctubbsii
ctubbsii / workspaces-linux-client-rpm.md
Last active April 15, 2022 01:44 — forked from nhira/workspaces-linux-client-rpm.md
How to install Amazon Workspaces Linux Client for Fedora
@ctubbsii
ctubbsii / 01-prompt
Created November 2, 2021 20:56
Fun bash prompt (~/.bashrc.d/01-prompt)
#! /usr/bin/bash
function getdecor() {
local decors='๐Ÿฅ๐ŸŽฏ๐Ÿฅ๐Ÿ‰๐ŸŒฏ๐Ÿ•๐Ÿฃ๐Ÿˆ๐Ÿฆ–๐ŸŒ€๐ŸŒ‚๐ŸŒˆ๐ŸŒŠ๐ŸŒ‹๐ŸŒ๐ŸŒŽ๐ŸŒ๐ŸŒŸ๐ŸŒญ๐ŸŒฎ๐ŸŒฏ๐ŸŒท๐ŸŒธ๐ŸŒน๐ŸŒบ๐ŸŒป๐ŸŒผ๐ŸŒฝ๐ŸŒพ๐Ÿ€๐Ÿ๐Ÿ„๐Ÿ…๐Ÿ‡๐Ÿ‰๐ŸŠ๐ŸŽ๐Ÿ๐Ÿ”๐Ÿ•๐Ÿ™๐Ÿœ๐Ÿฃ๐Ÿฅ๐Ÿฑ๐Ÿฒ๐ŸŽˆ๐ŸŽ‰๐ŸŽŠ๐ŸŽ๐ŸŽ ๐ŸŽฃ๐ŸŽฎ๐ŸŽฏ๐ŸŽณ๐ŸŽธ๐ŸŽน๐ŸŽป๐Ÿ€๐Ÿ๐Ÿ’๐Ÿน๐Ÿ…๐Ÿ†๐Ÿ‡๐Ÿˆ๐Ÿ‰๐ŸŠ๐Ÿ‹๐ŸŒ๐Ÿ๐ŸŽ๐Ÿ‘๐Ÿ’๐Ÿ•๐Ÿ˜๐Ÿ™๐Ÿš๐Ÿข๐Ÿฃ๐Ÿค๐Ÿง๐Ÿจ๐Ÿฌ๐Ÿฒ๐Ÿณ๐Ÿพ๐Ÿ‘€๐Ÿ‘“๐Ÿ‘ป๐Ÿ‘ฝ๐Ÿ’ ๐Ÿ’ก๐Ÿ’ข๐Ÿ’ฃ๐Ÿ’ค๐Ÿ’ฅ๐Ÿ’ฆ๐Ÿ’ง๐Ÿ’ฎ๐Ÿ’ฏ๐Ÿ’ฐ๐Ÿ’ฒ๐Ÿ’ป๐Ÿ“Œ๐Ÿ“๐Ÿ“Ž๐Ÿ“ก๐Ÿ“ฃ๐Ÿ”…๐Ÿ”†๐Ÿ”‹๐Ÿ”’๐Ÿ”“๐Ÿ””๐Ÿ”—๐Ÿ”ฅ๐Ÿ”ซ๐Ÿ”ฌ๐Ÿ”ญ๐Ÿ”ฎ๐Ÿ”ฑ๐Ÿ•บ๐Ÿ–•๐Ÿ––๐Ÿ—ผ๐Ÿ—ฝ๐Ÿ—พ๐Ÿ—ฟ๐Ÿš€๐Ÿšง๐Ÿšจ๐Ÿšฉ๐Ÿšซ๐Ÿšฝ๐Ÿ›ถ๐Ÿ›ธ๐Ÿ›น๐Ÿ›บ๐Ÿค˜๐Ÿฅ€๐Ÿฅ‚๐Ÿฅƒ๐Ÿฅ…๐Ÿฅ‹๐ŸฅŒ๐Ÿฅ๐ŸฅŽ๐Ÿฅ๐ŸฅŸ๐Ÿฆ„๐Ÿฆ…๐Ÿฆ‡๐Ÿฆˆ๐Ÿฆ‰๐ŸฆŠ๐Ÿฆ‹๐ŸฆŒ๐Ÿฆ๐ŸฆŽ๐Ÿฆ๐Ÿฆ๐Ÿฆ‘๐Ÿฆ’๐Ÿฆ“๐Ÿฆ”๐Ÿฆ•๐Ÿฆ–๐Ÿฆ˜๐Ÿฆš๐Ÿฆ๐Ÿฆ ๐Ÿฆจ๐Ÿงฌ๐Ÿงฒ๐Ÿช€๐Ÿช๐Ÿช‚๐Ÿช'
local res=${decors:$(( RANDOM % ${#decors} )):1}
[[ -n $SSH_CLIENT || -n $SSH_TTY ]] && res='@'
echo "$res"
}
case "$-" in
@ctubbsii
ctubbsii / InternerBenchmark.java
Created February 12, 2021 13:43
Benchmark to test StringInterning performance
package org.apache.accumulo.core.util;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;
import java.util.WeakHashMap;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
@ctubbsii
ctubbsii / thrift
Created February 21, 2019 22:07
Thrift command wrapper to switch automatically between different thrift versions when building Accumulo branches
#! /usr/bin/bash
set -e
rootDir=$(git rev-parse --show-toplevel)
ver=$(xmllint --shell "$rootDir/pom.xml" <<<'xpath /*[local-name()="project"]/*[local-name()="properties"]/*[local-name()="thrift.version"]/text()' | grep content= | cut -f2 -d=)
if [[ -x ~/bin/thrift-$ver ]]; then
~/bin/thrift-"$ver" "$@"
else
~/bin/thrift-0.11.0 "$@"
@ctubbsii
ctubbsii / etc_NetworkManager_conf.d_90-disable-randomization.conf
Last active January 31, 2025 20:10
NetworkManager configuration to disable WiFi MAC address randomization while scanning
# Place file in
# /etc/NetworkManager/conf.d/90-disable-randomization.conf
[device-mac-randomization]
# "yes" is the default for scanning in Fedora 25
wifi.scan-rand-mac-address=no
[connection-mac-randomization]
ethernet.cloned-mac-address=random
wifi.cloned-mac-address=random
@ctubbsii
ctubbsii / find_broken_file.sh
Created November 25, 2015 20:31
A small script to find which file in a commit broke the maven build
for x in $(git diff --name-status $(git merge-base master HEAD) | arg2); do
echo $x
git clean -fdx > /dev/null && \
git checkout $(git merge-base master HEAD) -- $x && \
(mvn clean verify 2>&1 | tee ../log-$(echo $x | tr / _).txt > ../log-current.txt; [[ ${PIPESTATUS[0]} == 0 ]]) && \
echo SUCCESS && \
break || \
echo FAILURE
done