Skip to content

Instantly share code, notes, and snippets.

View rpetti's full-sized avatar

Rob Petti rpetti

View GitHub Profile
@rpetti
rpetti / gist:bb52815d55e7b4023cbcf301589e2ef8
Created February 28, 2025 01:31
tmux alternating split window
# ctrl+b, enter: automatically splits window either vertically or horizontally based on current dimensions
bind-key Enter run-shell '[ $(expr #{pane_height} \* 25 / #{pane_width}) -gt 10 ] && tmux split-window -v || tmux split-window -h'
@rpetti
rpetti / docuum-daemonset.yml
Last active May 16, 2024 19:01
docuum daemonset for kubernetes
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: docuum
namespace: kube-system
labels:
k8s-app: docuum
spec:
selector:
matchLabels:
@rpetti
rpetti / .bashrc
Created January 20, 2024 06:00
change directory using ranger
function ranger-cd {
local IFS=$'\t\n'
local tempfile="$(mktemp -t tmp.XXXXXX)"
local ranger_cmd=(
command
ranger
--cmd="map <enter> chain shell echo %d > "$tempfile"; quitall"
)
${ranger_cmd[@]} "$@"
@rpetti
rpetti / export-awx-inventory.py
Created February 5, 2020 22:40
Export Ansible AWX/Tower Inventory to a standard Inventory
#!/usr/bin/python
import requests
import argparse
import sys
parser = argparse.ArgumentParser(description='Convert Ansible AWX/Tower Inventory to standard inventory')
parser.add_argument('--url', required=True, help='base url of AWX/Tower')
parser.add_argument('-u', '--username', help='username')
@rpetti
rpetti / o365-notifications.user.js
Created July 29, 2019 22:04 — forked from bparker98/o365-notifications.user.js
Office 365 Notifications Tampermonkey Script
// ==UserScript==
// @name Office 365 Notifications
// @namespace http://tampermonkey.net/
// @version 0.4
// @description try to take over the world!
// @author Brandon Parker
// @match https://outlook.office365.com/*
// @match https://outlook.office.com/*
// @iconURL https://r1.res.office365.com/owa/prem/16.1630.12.2223203/resources/images/0/favicon_mail.ico
// @UpdateURL https://gist.githubusercontent.com/bparker98/fdd125541c8ec9c676ca435e9eb9165a/raw/o365-notifications.user.js
#!/usr/bin/python
import marshal
import subprocess, shlex
import re
import os
import sys
clienthostcache = {}
@rpetti
rpetti / kill-scm-threads.groovy
Created January 24, 2018 17:19 — forked from andyjones/kill-scm-threads.groovy
Kills long running SCM polling threads in Jenkins
Jenkins.instance.getTrigger("SCMTrigger").getRunners().each()
{
item ->
long millis = Calendar.instance.time.time - item.getStartTime()
if(millis > (1000 * 60 * 60)) // 1000 millis in a second * 60 seconds in a minute * 3 minutes
{
Thread.getAllStackTraces().keySet().each()
{
tItem ->

Keybase proof

I hereby claim:

  • I am rpetti on github.
  • I am rpetti (https://keybase.io/rpetti) on keybase.
  • I have a public key whose fingerprint is 09CE 769D FE6B 78FA A08B A95B 9A66 5BE0 F3F3 92BE

To claim this, I am signing this object:

@rpetti
rpetti / auth-set.pl
Last active December 27, 2015 12:19
/etc/p4passwd contains plain text passwords (for administrator override). When a user changes their password, a shadow password entry is added to /etc/p4shadow, which is used for authentication from then-on. If the user isn't in the p4passwd or p4shadow file, it will use ldap authentication.
#!/usr/bin/perl
# p4 trigger: updateLocalPw auth-set auth "%serverroot%/triggers/auth-set.pl %user% %serverroot%/triggers/ldap-check-auth.pl"
$login = shift(ARGV);
$authCmd = shift(ARGV);
open(LCL_PASSWD_FILE,"</etc/p4shadow") or die "Can't open local shadow password file.";
@PASSWD = <LCL_PASSWD_FILE>;
close(LCL_PASSWD_FILE);
def project = hudson.model.Hudson.instance.getItem("Project A");
project.lastSuccessfulBuild == project.lastBuild;