Skip to content

Instantly share code, notes, and snippets.

@nilsmagnus
nilsmagnus / golang_redis.go
Last active July 26, 2022 17:24
Connect to redis with golang on heroku
import "gopkg.in/redis.v3"
var (
//Client for the database connection
client *redis.Client
)
func connect() {
var resolvedURL = os.Getenv("REDIS_URL")
var password = ""
#!/usr/bin/env groovy
@Grab(group = 'org.codehaus.groovy.modules.http-builder', module = 'http-builder', version = '0.5.1')
import groovyx.net.http.*;
import static groovyx.net.http.ContentType.*;
import static groovyx.net.http.Method.*;
class NexusArtifactCleanup {
/**
@nilsmagnus
nilsmagnus / exc_images_tour_go.go
Created January 29, 2015 19:56
Exercise: Images
package main
import (
"code.google.com/p/go-tour/pic"
"image"
"image/color"
)
type Image struct{}
@nilsmagnus
nilsmagnus / http_handlers_excersize.go
Created January 29, 2015 19:17
tour of go excersize
package main
import (
"fmt"
"log"
"net/http"
)
type String string
@nilsmagnus
nilsmagnus / rot13reader.go
Created January 24, 2015 20:57
rot 13 reader from exercise of the tour
package main
import (
"io"
"os"
"strings"
)
type rot13Reader struct {
r io.Reader
package main
import "code.google.com/p/go-tour/reader"
type MyReader struct{}
func (reader *MyReader) Read(b []byte )(n int, e error) {
for i:=0; i< len(b); i++ {
b[i] = 'A'
}
apply plugin: 'java'
apply plugin: 'application'
mainClassName = "com.example.dw.WebApplication"
applicationDefaultJvmArgs = ['-Ddw.server.applicationConnectors[0].port=$PORT']
/**
rest omitted due to relevance
*/
@nilsmagnus
nilsmagnus / bindings.xml
Created April 28, 2014 06:30
Wsdl2Java Cxf Binding File to Rename Complextype
<?xml version="1.0" encoding="UTF-8"?>
<jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<jaxws:bindings node="wsdl:definitions/wsdl:types/xsd:schema[1]">
<jxb:bindings node="//xs:complexType[@name='VatNumber_exception']">
<jxb:class name="VatNumException"/>
</jxb:bindings>
</jaxws:bindings>
</jaxws:bindings>
@nilsmagnus
nilsmagnus / AppengineExecutor.java
Last active August 31, 2019 20:45
Appengine executorservice usage
package no.nilsapp.someapp.cronjobs;
import com.google.appengine.api.ThreadManager;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
@nilsmagnus
nilsmagnus / gist:7659424
Created November 26, 2013 14:40
Privacy policy
Do we use cookies?
We do not use cookies.
Do we disclose any information to outside parties?
We do not sell, trade, or otherwise transfer to outside parties your personally identifiable information. This does not include trusted third parties who assist us in operating our website, conducting our business, or servicing you, so long as those parties agree to keep this information confidential. We may also release your information when we believe release is appropriate to comply with the law, enforce our site policies, or protect ours or others rights, property, or safety. However, non-personally identifiable visitor information may be provided to other parties for marketing, advertising, or other uses.