Skip to content

Instantly share code, notes, and snippets.

View lanwen's full-sized avatar
🎃
Thats my status

Kirill Merkushev lanwen

🎃
Thats my status
View GitHub Profile
@lanwen
lanwen / gist:7082123
Last active December 26, 2015 02:59
Way to unmarshall jaxb-objects from xml
public static <T> T unmarshal(Class<T> clazz, String xml) throws JAXBException {
JAXBContext jc = JAXBContext.newInstance(clazz);
Unmarshaller u = jc.createUnmarshaller();
JAXBElement<T> root = u.unmarshal(new StreamSource(IOUtils.toInputStream(xml)), clazz);
return root.getValue();
}
Thread 5581: (state = BLOCKED)
- hudson.slaves.CloudRetentionStrategy.check(hudson.slaves.AbstractCloudComputer) @bci=0, line=54 (Interpreted frame)
- hudson.slaves.CloudRetentionStrategy.check(hudson.model.Computer) @bci=5, line=45 (Interpreted frame)
- hudson.slaves.SlaveComputer.setNode(hudson.model.Node) @bci=36, line=661 (Interpreted frame)
- hudson.model.AbstractCIBase.updateComputer(hudson.model.Node, java.util.Map, java.util.Set, boolean) @bci=29, line=120 (Interpreted frame)
- hudson.model.AbstractCIBase.updateComputerList(boolean) @bci=169, line=180 (Interpreted frame)
- jenkins.model.Jenkins.updateComputerList() @bci=4, line=1218 (Interpreted frame)
- jenkins.model.Jenkins.setNodes(java.util.List) @bci=13, line=1714 (Interpreted frame)
- jenkins.model.Jenkins.addNode(hudson.model.Node) @bci=40, line=1696 (Interpreted frame)
- hudson.slaves.NodeProvisioner.update() @bci=209, line=204 (Compiled frame)
@lanwen
lanwen / jenkins.dump.txt
Created September 23, 2015 22:40
Locked job-dsl 1.38
"Executor #0 for local-04587138efa9 : executing configuration-generate_views #199" Id=1899 Group=main WAITING on org.codehaus.groovy.util.LockableObject@3384217
at sun.misc.Unsafe.park(Native Method)
- waiting on org.codehaus.groovy.util.LockableObject@3384217
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:867)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197)
at org.codehaus.groovy.util.LockableObject.lock(LockableObject.java:34)
at org.codehaus.groovy.reflection.ClassInfo.lock(ClassInfo.java:268)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:193)
@lanwen
lanwen / envsubst.sh
Created October 23, 2015 09:30
Expand sys vars in template
envsubst < "fig.yml.tpl" > "fig.yml"
@lanwen
lanwen / docker-entrypoint.sh
Created October 23, 2015 09:31
Entrypoint example with waiter for port
#!/bin/bash
set -e
cp config/local.tpl config/local.yml
export DB_TCP="/dev/tcp/${DB_1_PORT_3306_TCP_ADDR}/${DB_1_PORT_3306_TCP_PORT}"
# See http://tldp.org/LDP/abs/html/devref1.html for description of this syntax.
while ! exec 6<>${DB_TCP}; do
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<module name="TreeWalker">
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
@lanwen
lanwen / nosetests profiling
Created June 16, 2016 22:43 — forked from jassinm/nosetests profiling
nosetest profiling
nosetests --with-profile --profile-stats-file=nose.prof
python -c "import hotshot.stats ; stats = hotshot.stats.load('nose.prof') ; stats.sort_stats('time', 'calls') ; stats.print_stats(20)"
@lanwen
lanwen / sse.go
Created March 14, 2017 20:48 — forked from schmohlio/sse.go
Example SSE server in Golang
// v2 of the great example of SSE in go by @ismasan.
// includes fixes:
// * infinite loop ending in panic
// * closing a client twice
// * potentially blocked listen() from closing a connection during multiplex step.
package main
import (
"fmt"
"log"
public class CreateTicketBuildStep extends Builder implements SimpleBuildStep {
public static class ConverterImpl extends XStream2.PassthruConverter<CreateTicketBuildStep> {
private static final Logger LOGGER = LoggerFactory.getLogger(ConverterImpl.class);
public ConverterImpl(XStream2 xstream) {
super(xstream);
}
@Override
@lanwen
lanwen / eventsource.js
Created March 19, 2017 22:11 — forked from mattpodwysocki/eventsource.js
Adding support for server-sent events for RxJS
if (!!root.EventSource) {
/**
* This method wraps an EventSource as an observable sequence.
* @param {String} url The url of the server-side script.
* @param {Observer} [openObserver] An optional observer for the 'open' event for the server side event.
* @returns {Observable} An observable sequence which represents the data from a server-side event.
*/
dom.fromEventSource = function (url, openObserver) {
return new AnonymousObservable(function (observer) {