Skip to content

Instantly share code, notes, and snippets.

@pysysops
pysysops / jenkins-job-branches
Last active January 15, 2016 11:40
Snippet of Job template that I use to create jobs for each branch of projects that have been active in the past 14 days. Basically adds to a folder of Jenkins generated Job Builder YAML that gets updated on scm change. Hacky but it's a start.
#!/bin/bash
#This script is a magical script to generate jobs for each active branch of a git repo.
#Add some randomness to give bitbucket / git a break
sleep $(( ( RANDOM % 10 ) + 10 ))
cd $WORKSPACE
daysToKeep=14
#Jenkins generated configs go in here...
@pysysops
pysysops / github_ssh.sh
Last active August 18, 2016 09:14
Add an SSH Key and push it to your Github Enterprise account using the API. Great for lazy people like me!
#!/bin/sh
GIT_SERVER="git.example.com"
GITHUB_API_URL="https://$GIT_SERVER/api/v3"
# Setup an SSH key
if [ ! -f ~/.ssh/id_rsa ]; then
ssh-keygen -b 4096 -t rsa -f ~/.ssh/id_rsa -q -N ""
fi
@pysysops
pysysops / jenkins-swarm.job.plist
Last active January 8, 2020 20:08
LaunchAgent configuration for Jenkins Swarm Agent ( https://wiki.jenkins-ci.org/display/JENKINS/Swarm+Plugin ) to run on Mac OS X.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>jenkins-swarm.job</string>
@pysysops
pysysops / OpenVPN_NM_Config
Last active March 9, 2016 15:00
/etc/NetworkManager/system-connections/<<VPNName>>
[connection]
id=<<VPNName>>
uuid=<<UUID>>
type=vpn
autoconnect=true
permissions=
secondaries=
timestamp=1450953669
zone=work
pseudo-random loadbalancing:
scope['cdl_logstash::gelf_servers'][ @ipaddress.gsub(/[\D]+/i,'').to_i % scope['cdl_logstash::gelf_servers'].length.to_i ]
# This file is managed by Puppet. ANY MANUAL CHANGES WILL BE DESTROYED
# Long log messages should be trimmed down to something reasonable (1500 characters)
WLS_FORMAT_1 <%{DATA:wls_timestamp} o'clock %{DATA}> <%{WORD:severity}> <%{DATA:wls_topic}> <%{HOST:hostname}> <(%{WORD:server})?>( <(\[%{DATA:thread_status}\] )?ExecuteThread: '%{INT:thread_nr}' for queue: '%{DATA:thread_queue}'>)? (?<log_message>[\w\W]{0,2500})
WLS_FORMAT_2 <%{DATA:wls_timestamp} o'clock %{DATA}> <%{WORD:severity}> <%{DATA:wls_topic}> <%{HOST:hostname}> <(%{WORD:server})?> (?<log_message>[\w\W]{0,2500})
WLS_FORMAT_3 <%{DATA:wls_timestamp} o'clock %{DATA}> <%{WORD:severity}> <%{DATA:wls_topic}> <%{HOST:subsystem}>? (?<log_message>[\w\W]{0,2500})
WLS_FORMAT_4 <%{DATA:wls_timestamp} o'clock %{DATA}> <%{WORD:severity}> <%{DATA:wls_topic}> (?<log_message>[\w\W]{0,2500})
WLS_FORMAT %{WLS_FORMAT_1}|%{WLS_FORMAT_2}|%{WLS_FORMAT_3}|%{WLS_FORMAT_4}
.green-bg {
background-color: #84c61c;
color: #ffffff;
}
@pysysops
pysysops / hiera_undef.yaml
Created October 13, 2016 11:07
Undef a parameter in Puppet hiera
class::parameter::name: null
class::parameter::name: Null
class::parameter::name: NULL
class::parameter::name: ~
@pysysops
pysysops / Weblogic Configs
Last active April 21, 2017 19:49
Weblogic related gotchas / useful config options
1. On Linux / WLS 12c there is a problem with the TCP unicast work manager blocking, it causes nodes in a cluster to failover. Add:
-Dweblogic.unicast.HttpPing=true
To server start args. It's a known / documented issue: https://docs.oracle.com/cd/E24329_01/doc.1211/e26593/issues.htm#WLSRN182
2. Memory leaks. If you use RMI which you probably do and suffer from Memory leaks, forget tuning the app code (it's Java,
it'll always have memory leaks) Take a heap dump adn run it through jmap or create diffs from 2. If you see this class pop
up in retained heap or memory leak suspects: weblogic.rjvm.ConnectionManage Add:
#!/usr/bin/env python
import sys
import urllib
import urllib2
import json
import argparse
import ssl
import time
from urlparse import urlparse