Skip to content

Instantly share code, notes, and snippets.

View witokondoria's full-sized avatar

Javier Delgado witokondoria

  • Madrid
View GitHub Profile
@witokondoria
witokondoria / remove-orphan-images.sh
Created May 23, 2016 09:04 — forked from bjaglin/remove-orphan-images.sh
Remove orphan layers left by the "file" storage backend of the docker registry, heavily inspired by https://gist.github.com/shepmaster/53939af82a51e3aa0cd6
#!/bin/bash
set -eu
shopt -s nullglob
readonly base_dir=/var/lib/docker/registry
readonly output_dir=$(mktemp -d -t trace-images-XXXX)
readonly jq=/usr/bin/jq
readonly repository_dir=$base_dir/repositories
@witokondoria
witokondoria / jenkinslist.coffee
Last active September 8, 2016 14:51
Awesome jenkins job dashing widget
class Dashing.Jenkinslist extends Dashing.Widget
ready: ->
if @get('unordered')
$(@node).find('ol').remove()
else
$(@node).find('ul').remove()
@witokondoria
witokondoria / jenkinsmeter.coffee
Last active September 15, 2016 13:49
Awesome jenkins job dashing widget
class Dashing.Jenkinsmeter extends Dashing.Widget
@accessor 'value', Dashing.AnimatedValue
constructor: ->
super
@observe 'value', (value) ->
$(@node).find(".meter").val(value).trigger('change')
ready: ->
scripting console reachable at ${JENKINS_HOME}/script allows us to perform multiple maintenance operations
Raw
@witokondoria
witokondoria / switcher.coffee
Created November 8, 2016 07:59
switcher dashing widget
# Switcher widget written by Juha Mustonen / SC5
# Switches (reloads to another address) the dashboards in periodic manner
# <div id="container" data-switcher-interval="10000" data-switcher-dashboards="dashboard1 dashboard2">
# <%= yield %>
# </div>
#
class DashboardSwitcher
constructor: () ->
@dashboardNames = []
@witokondoria
witokondoria / docker-staging-cleanup.groovy
Created May 12, 2017 12:56
wiping nexus3 docker images
import org.sonatype.nexus.repository.storage.StorageFacet
def dockerRepository = repository.repositoryManager.get('docker-staging')
def dockerBlobStore = blobStore.blobStoreManager.get(dockerRepository.configuration.attributes.storage.blobStoreName)
def storageTx = dockerRepository.facet(StorageFacet.class).txSupplier().get()
try {
storageTx.begin()
dockerRepository.stop()
def bucket = storageTx.findBucket(dockerRepository)
@witokondoria
witokondoria / pipeline.log
Created June 15, 2017 08:03
Mockito NotSerializableException
java.io.NotSerializableException: org.mockito.internal.creation.DelegatingMethod
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
java.util.ConcurrentModificationException
at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1211)
at java.util.TreeMap$EntryIterator.next(TreeMap.java:1247)
at java.util.TreeMap$EntryIterator.next(TreeMap.java:1242)
at com.thoughtworks.xstream.converters.collections.MapConverter.marshal(MapConverter.java:75)
at com.thoughtworks.xstream.converters.collections.TreeMapConverter.marshal(TreeMapConverter.java:59)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265)
@witokondoria
witokondoria / gpg-import-and-export-instructions.md
Created August 24, 2017 07:34 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

try {
sh "mvn test"
} catch (terr) {
throw new GroovyRuntimeException("Exception on tests", terr)
} finally {
archive "**/surefire-reports/*.xml"
try {
junit allowEmptyResults: true, keepLongStdio: true, testResults: "**/target/${crossbuild}/surefire-reports/*.xml"
} catch (juterr) {
mail X