Skip to content

Instantly share code, notes, and snippets.

View stobias123's full-sized avatar

Steven Tobias stobias123

View GitHub Profile

Keybase proof

I hereby claim:

  • I am stobias123 on github.
  • I am stobias123 (https://keybase.io/stobias123) on keybase.
  • I have a public key ASDdHlDtkKTnTmBeRdszn03XQvZ13ZRylMIY1L3iae02nAo

To claim this, I am signing this object:

@stobias123
stobias123 / findBuilds.groovy
Last active April 10, 2018 18:56
Jenkins set log rotators
jenkins.model.Jenkins.instance.getAllItems().each {
if ( it.getClass() != com.cloudbees.hudson.plugins.folder.Folder && it.getClass() != org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject ){
try {
if (it.getLastBuild().number != null && it.getLastBuild().number > 10 ){
if(it.getLogRotator() == null){
println it.getFullName() + " Build number " + it.getLastBuild().number;
if(it.getClass() != org.jenkinsci.plugins.workflow.job.WorkflowJob){
println ' ---> Setting a log rotator that will delete any artifacts/builds older than number 200'
//job.logRotator = new hudson.tasks.LogRotator ( null, 200, 00, 200)
}
import groovyx.net.http.*
import org.apache.log4j.Logger
import org.apache.log4j.Level
import groovy.json.JsonBuilder
import groovy.json.StreamingJsonBuilder;
RESTClient myClient
@stobias123
stobias123 / Utils-vagrant-box
Last active January 30, 2019 23:05
Vagrant box for dev
Vagrant.configure("2") do |config|
config.vm.define "dev_box" do |machine|
machine.vm.box = "centos/7"
machine.vm.hostname = "local-dev-box"
machine.vm.box_download_insecure = true
machine.vm.provision "shell", inline: <<-SCRIPT
echo "sslverify=false" >> /etc/yum.conf
yum install -y epel-release && yum -y upgrade
yum install -y yum-utils vim \
@stobias123
stobias123 / asm_policy_export.py
Created March 5, 2019 02:15
Exports all policies from an F5 Server
from f5.bigip import ManagementRoot
from time import sleep
def task_checker(task):
while True:
task.refresh()
if task.status in ['COMPLETED', 'FAILURE']:
break
sleep(1)
assert task.status == 'COMPLETED' # this will raise assertion error if export task fails
reg add HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters /v DisabledComponents /t REG_DWORD /d 0x000000FF
@stobias123
stobias123 / wavefront callback
Created April 1, 2020 16:39
Ansible Callback for wavefront.
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import time
from wavefront_api_client.rest import ApiException
from pprint import pprint
from os.path import basename
import wavefront_api_client as wave_api
@stobias123
stobias123 / wavefront.py
Created April 1, 2020 16:39
Ansible Callback for wavefront.
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import time
from wavefront_api_client.rest import ApiException
from pprint import pprint
from os.path import basename
import wavefront_api_client as wave_api
@stobias123
stobias123 / govc
Last active April 3, 2020 08:13
Command line autocompletion for `govc`
#compdef govc
_govc () {
local line
local -a top_level_cmds
top_level_cmds=$(_govc_top_level_commands)
_arguments -C \
'1: :_govc_top_level_commands' \
"*::arg:->args"
@stobias123
stobias123 / tensorforce_agent.py
Created June 29, 2020 02:45
Tensorforce Problems
## tensorforce_agent.py
# This code breaks immediately here with "Unknown Gym Environment"
env = gym.make("my_gm:level-v0")
environment = Environment.create(environment='gym', level=env, max_episode_timesteps=1000)
## it works fine as shown int his file. :/
class RandomAgent(object):
"""The world's simplest agent!"""
def __init__(self, action_space):