Skip to content

Instantly share code, notes, and snippets.

apply plugin: 'java'
apply plugin: 'application'
mainClassName = "com.example.dw.WebApplication"
applicationDefaultJvmArgs = ['-Ddw.server.applicationConnectors[0].port=$PORT']
/**
rest omitted due to relevance
*/
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'
}
@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
@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 / 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{}
#!/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 / 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 = ""
@nilsmagnus
nilsmagnus / scan.sh
Created October 5, 2016 19:25
scan for probe requests
sudo apt-get install tshark
sudo ifconfig wlp2s0 down
sudo iwconfig wlp2s0 mode monitor
sudo ifconfig wlp2s0 up
tshark -i wlp2s0 -N m -T fields -e eth.addr_resolved -e eth.addr
@nilsmagnus
nilsmagnus / kafka_consumer.go
Created February 15, 2017 08:04
Example of go consuming from kafka, using the shopify/sarama library
package main
import (
"fmt"
"github.com/Shopify/sarama"
"os"
"os/signal"
"strings"
)
@nilsmagnus
nilsmagnus / get_offsets.go
Created February 15, 2017 09:11
Get newest offsets of all topics for your client, using the sarama/shopify library.
package main
import (
"github.com/Shopify/sarama"
"log"
"time"
"fmt"
"strings"
)