Skip to content

Instantly share code, notes, and snippets.

require 'git'
g = Git.open(working_dir)
untracked_files = gitstatus_untracked_workaround(g)
def gitstatus_untracked_workaround(g)
gem_rubygit_buggy_untracked_files = g.status.untracked.keys
git_files = `git --work-tree=#{g.dir} --git-dir=#{g.dir}/.git ls-files -z -d -m -o -X .gitignore`.split("\x0")
gem_rubygit_buggy_untracked_files & git_files
end
@msutter
msutter / master-node-config.groovy
Last active May 1, 2023 15:48
jenkins master node executors and restriction
#!groovy
import jenkins.model.*
import hudson.model.*
import hudson.slaves.*
import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.nodes.JobRestrictionProperty;
import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.restrictions.job.RegexNameRestriction;
import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.util.GroupSelector;
// Set nummber of executors
def instance = Jenkins.getInstance()
Jenkins.instance.pluginManager.plugins.each{
plugin ->
println ("${plugin.getShortName()}:${plugin.getVersion()}")
}
network-interfaces: |
auto lo
iface lo inet loopback
iface ens3 inet dhcp
iface ens4 inet dhcp
@msutter
msutter / pet-snippet.toml
Last active March 11, 2018 08:55
description
[[snippets]]
description = "Create a .keep file in all empty directories"
command = "find . -type d -empty -print0 | xargs -0 -I % touch %/.keep"
output = ""
[[snippets]]
description = "Display all listen port"
command = "lsof -Pan -i tcp -i udp"
output = ""
# commands to be used on the bastion host
file=/etc/origin/master/master-config.yaml
key=projectConfig.projectRequestMessage
value='Please create project using the portal or contact admin@example.com'
# list entry
ansible masters -m command -a "/usr/local/sbin/yamledit -f ${file} -g ${key}"
# update entry
# install yamledit to be used with ansible to update yaml files
# this must be done on your master, infra and node hosts
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install -i ./epel-release-latest-7.noarch.rpm
yum -y install python-pip
pip install ruamel.yaml
if [ ! -d yamledit ]
then
git clone https://github.com/microtodd/yamledit.git
fi
root@master:~ # puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Resource Statement, Class[Ntp]:
parameter 'config_epp' expects a String value, got Hash
parameter 'config_template' expects a String value, got Hash
parameter 'keys_controlkey' expects a value of type ntp::key_id = Integer[1, 65534] or Pattern[/^\d+$/, //], got Hash[Unit, Unit, 0, 0]
parameter 'keys_requestkey' expects a value of type ntp::key_id = Integer[1, 65534] or Pattern[/^\d+$/, //], got Hash[Unit, Unit, 0, 0]
docker volume ls -f dangling=true
DRIVER VOLUME NAME
local 002cc45096db5d7b5535b3a2c0b1c6418d71dd965a9db40b052f0d021a915329
local 0142c6323ffaa73eb5a39297c7837601b6335727d14144694d6cb4a52fa2b86c
local 014b858ee4f1a63ed5bfe719e3f7cf3fc4488bc4cfbbfc11d1c8e1aa26270f22
local 031555b35b84aa7a54d723f72fa8e27295ac09ad62e4fd32a030e89f8916a70b
local 038e8985832088758f4d4b8d83a4a274c726d78028febb6b744a979c486e167b
local 05b482c142b13a7e30ce42958017777b1f56e7c2f9d19c4514ad95c2898ca06f
local 076038107f2155276b1129279414f966461360698f9cbc4ac6da768f99b20877
local 0958f47b6517974968126238ce479d31ec9769b6ce618b06b0a34a1ef92b5c1c

Keybase proof

I hereby claim:

  • I am msutter on github.
  • I am msutter (https://keybase.io/msutter) on keybase.
  • I have a public key whose fingerprint is 128F E4EA 73E7 A2A3 5942 4A1F 3ED8 8B0E 96D7 2B72

To claim this, I am signing this object: