Skip to content

Instantly share code, notes, and snippets.

Avatar

Steven Tobias stobias123

View GitHub Profile
View keybase.md

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 Apr 10, 2018
Jenkins set log rotators
View findBuilds.groovy
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)
}
View gist:d1759e0d61e58ea94e4994c98566ab4c
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 Jan 30, 2019
Vagrant box for dev
View Utils-vagrant-box
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 Mar 5, 2019
Exports all policies from an F5 Server
View asm_policy_export.py
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
View gist:78a839d13b2386098aedd875802ee7bb
reg add HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters /v DisabledComponents /t REG_DWORD /d 0x000000FF
@stobias123
stobias123 / wavefront callback
Created Apr 1, 2020
Ansible Callback for wavefront.
View wavefront callback
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 Apr 1, 2020
Ansible Callback for wavefront.
View wavefront.py
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 Apr 3, 2020
Command line autocompletion for `govc`
View 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"
View tensorforce_agent.py
## 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):