Skip to content

Instantly share code, notes, and snippets.

View bmannix's full-sized avatar

Brendan Mannix bmannix

View GitHub Profile
def notifyBuild(String buildStatus) {
// build status of null means successful
buildStatus = buildStatus ?: 'SUCCESSFUL'
// Default values
def subject = "${buildStatus}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'"
def summary = "${subject} (${env.BUILD_URL})"
def details = """<p>STARTED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':</p>
<p>Check console output at "<a href='${env.BUILD_URL}'>${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>"</p>"""
@bmannix
bmannix / GitHub curl.sh
Created March 28, 2016 22:32 — forked from Integralist/GitHub curl.sh
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
import json
from browsermobproxy import Server
import requests
from selenium import webdriver
bmp_path = "browsermob-proxy-2.1.0-beta-3/bin/browsermob-proxy"
sut = "http://the-internet.herokuapp.com/"
server = Server(bmp_path)
server.start()
@bmannix
bmannix / gist:9112111e1048c3e6b3d5
Last active August 29, 2015 14:27 — forked from callmephilip/gist:3519403
[JavaScript] Dispatching keyboard event
// gecko and webkit
// details here https://developer.mozilla.org/en-US/docs/DOM/event.initKeyEvent
var keyboardEvent = document.createEvent("KeyboardEvent");
var initMethod = typeof keyboardEvent.initKeyboardEvent !== 'undefined' ? "initKeyboardEvent" : "initKeyEvent";
keyboardEvent[initMethod](
"keydown", // event type : keydown, keyup, keypress
true, // bubbles
@bmannix
bmannix / auto_rebuild.tcl
Last active January 12, 2018 05:10
Ansible driven expect script
#!/usr/bin/expect
set timeout 30
#setup some abitrary commands
set cmdstr(0) "cd /opt/obb/server"
set cmdstr(1) ". build/setup"
set cmdstr(2) "rebuild_db"
spawn /bin/bash
#send the first command
send "$cmdstr(0)\n"
#wait for a prompt to appear
@bmannix
bmannix / gist:10301435
Last active August 29, 2015 13:58 — forked from aurynn/gist:10121896
from twisted.internet.protocol import Factory
from twisted.internet.endpoints import TCP4ClientEndpoint, connectProtocol
from twisted.internet import reactor, defer, stdio
from twisted.protocols.basic import LineReceiver
import json
your_name = "bmannix"
class NotConnectedError(BaseException): pass
@bmannix
bmannix / gist:10116829
Last active August 29, 2015 13:58
Vagrant overview for Gagan
Building your own baseboxes:
http://briceno.mx/2012/10/easy-guide-to-create-a-vagrant-box-from-virtualbox/
http://feed2.me/post/44067313534/building-your-own-base-box-for-vagrant
List of generic baseboxes:
http://www.vagrantbox.es/
Hey Gagan,
Here are some resources for building baseboxes.
@bmannix
bmannix / get_sel_vers.py
Last active December 19, 2015 03:08
get Selenium version used by Selenium2Library and log it
from robot.libraries.BuiltIn import BuiltIn
from robot.api import logger
def log_s2l_version():
"""
Gets the Selenium version used by Selenium2Library
"""
seleniumlib = BuiltIn().get_library_instance('Selenium2Library')
browser = seleniumlib._current_browser()
sel_version = locals()['webdriver'].__version__
#!/bin/bash -xe
#THIS SCRIPT MUST BE RUN AS ROOT
ADMIN_USER=admin
ADMIN_GROUP=admin
#add admin group
(cat /etc/group | grep -E '\b$ADMIN_GROUP\b') || sudo groupadd $ADMIN_GROUP
@bmannix
bmannix / pyfab.py
Created April 9, 2012 17:52
pyfab provides a simpler fabric interface for python
import fabfile as fab
class Pyfab:
def __init__(self, role, user):
self.role = role
self.user = user
def fab_exec(self, command, *args, **kwargs):
'''
this runs fabric commands defined in the fabfile. By default it