Skip to content

Instantly share code, notes, and snippets.

@sdorra
sdorra / NotificationService.java
Created December 20, 2012 06:56
scm-mail-plugin usage example.
/**
*
* @author Sebastian Sdorra
*/
public class NotificationService
{
private static final Logger logger = LoggerFactory.getLogger(
NotificationService.class);
private MailService mailService;
@Extension
public class ReportContextListener implements ServletContextListener {
private final AdministrationContext adminContext;
private final SchedulerFactory schedulerFactory;
@Inject
public ReportContextListener(AdministrationContext adminContext,
SchedulerFactory schedulerFactory){
this.adminContext = adminContext;
@sdorra
sdorra / server-config-v1.xml
Created October 18, 2014 12:10
SCM-Manager and the POODLE vulnerability
<Arg>
<New class="org.eclipse.jetty.http.ssl.SslContextFactory">
<Set name="excludeProtocols">
<Array type="java.lang.String">
<Item>SSLv2Hello</Item>
<Item>SSLv3</Item>
</Array>
</Set>
</New>
</Arg>
@sdorra
sdorra / docker-sample.sh
Created November 21, 2014 16:52
SCM-Manager Docker
# run the latest scm-manager version
docker run sdorra/scm-manager
# expose scm-manager http port
docker run -p 8080:8080 sdorra/scm-manager
# run a specific scm-manager version
# version 1.42 is currently the only available version
docker run -p 8080:8080 sdorra/scm-manager:1.42
@sdorra
sdorra / Listener.java
Created December 6, 2014 19:20
Legman example
@EagerSingleton
public class Listener {
@Subsribe
public void handleEvent(PostReceiveRepositoryHookEvent event){
// handle event
}
}
@sdorra
sdorra / adf.html
Last active September 4, 2015 20:44
ADF shared data
<div>
<h3>angular-dashboard-framework</h3>
<p>Dashboard framework with Angular.js and Twitter Bootstrap.</p>
</div>
@sdorra
sdorra / app.go
Created April 6, 2016 19:48
SSEvents with golang
package main
import (
"io"
"strconv"
"time"
"github.com/gin-gonic/gin"
)
@sdorra
sdorra / keys.go
Created April 17, 2016 19:31
Golang RSA Key Generation
/*
* Genarate rsa keys.
*/
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
@sdorra
sdorra / App.java
Created June 15, 2016 20:27
Jackson sample with deep field filter
public class App {
public static void main(String[] args) {
Type type = new Type("hg", "Mercurial");
Repository repository = new Repository("42", "scm", type, "SCM-Manager", "SCM-Manager Repository Hosting");
System.out.println(JSON.asString(repository));
System.out.println(JSON.asString(repository, "id", "desc"));
System.out.println(JSON.asString(repository, "id", "name", "type", "type.name", "displayName"));
}
@sdorra
sdorra / cert.go
Created July 3, 2016 20:56
Certificate generation in Go
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"log"
"math/big"