Skip to content

Instantly share code, notes, and snippets.

View wrossmck's full-sized avatar
🦊

Ross McKinley wrossmck

🦊
View GitHub Profile
@wrossmck
wrossmck / makeOSXiso.sh
Created November 18, 2015 11:10
Convert Downloaded El Capitan.app to bootable iso
#!/bin/bash
#taken from http://www.insanelymac.com/forum/topic/308533-how-to-create-a-bootable-el-capitan-iso-fo-vmware/
# Mount the installer image
hdiutil attach /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
# Create the ElCapitan Blank ISO Image of 7316mb with a Single Partition - Apple Partition Map
hdiutil create -o /tmp/ElCapitan.cdr -size 7316m -layout SPUD -fs HFS+J
@wrossmck
wrossmck / find-uninitialised-git-submodule.sh
Last active May 19, 2016 09:49
initialise only non-initialised git submodules
#!/bin/bash
INIT_LIST=$(git submodule status | grep "\-[a-z0-9]\{40\}" | sed 's#\(\-[a-z0-9]\{40\} \)##g')
IFS=$'\n'; for l in $INIT_LIST; do git submodule update --init $l; done
@wrossmck
wrossmck / .gitattributes
Created February 1, 2017 17:58
`.gitattributes` for Unity 3d git-lfs project
# other
*.anim filter=lfs diff=lfs merge=lfs -text
*.cubemap filter=lfs diff=lfs merge=lfs -text
*.exr filter=lfs diff=lfs merge=lfs -text
*.fbx filter=lfs diff=lfs merge=lfs -text
*.otf filter=lfs diff=lfs merge=lfs -text
# images
*.bmp filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
@wrossmck
wrossmck / git-latest.ps1
Created June 11, 2018 07:27
pull latest from master in all subdirectories
Get-ChildItem -Recurse -Directory -Hidden -Filter .git | ForEach-Object { & git --git-dir="$($_.FullName)" --work-tree="$(Split-Path $_.FullName -Parent)" pull origin master }
@wrossmck
wrossmck / clean-local-branches.sh
Last active September 27, 2018 09:09
delete all local git branches except master
#!/bin/bash
git branch | grep -v "master" | xargs git branch -D
@wrossmck
wrossmck / delete-offline-jenkins-agents.groovy
Created September 27, 2018 09:09
Deletes offline jenkins agents from /script console (or CJOC)
Jenkins.instance.nodes.each {
if (it.computer.isOffline()){
println(it.name)
it.computer.doDoDelete()
}
}
@wrossmck
wrossmck / install-plugin.groovy
Created October 9, 2018 18:26
Install a specific plugin on jenkins master via groovy
// installs single hardcoded plugin
import jenkins.model.*
import java.util.logging.Logger
def logger = Logger.getLogger("")
def installed = false
def initialized = false
def pluginParameter="apache-httpcomponents-client-4-api" // this could be a parameter if we wanted
def plugins = pluginParameter.split()
logger.info("" + plugins)
@wrossmck
wrossmck / get-plugins.groovy
Created October 9, 2018 18:27
list available vs current jenkins plugins
Jenkins.instance.updateCenter.getAvailables().each{
println "${it.name}:${it.version}"
}
Jenkins.instance.pluginManager.plugins.each{
println "${it}:${it.version}"
}
@wrossmck
wrossmck / promote-all-plugins.groovy
Created October 9, 2018 18:29
promote all plugins available on jenkins update center (CJOC)
// promote all update center plugins
import com.cloudbees.plugins.updatecenter.PluginData
// Example of an update center "myUpdateCenter" at root level, could be parameter to this job
def updateCenterFullName = "myUpdateCenter"
jenkins.model.Jenkins.instance.getItemByFullName("${updateCenterFullName}").getPluginsData().each { PluginData pluginData ->
if(pluginData.getVersions() != null && !pluginData.getVersions().isEmpty()) {
println "Promoting '${pluginData.getName()}' to version '${pluginData.getVersions().lastKey()}'"
pluginData.setPromotedVersion("${pluginData.getVersions().lastKey()}")
@wrossmck
wrossmck / cancel-builds.groovy
Created October 9, 2018 18:30
cancel all builds in queue called
// cancel all builds in queue called
import hudson.model.*
def q = Jenkins.instance.queue
q.items.each {
println (it)
if (it =~ /my.job.to.kill/) {
q.cancel(it.task)
}