Skip to content

Instantly share code, notes, and snippets.

@nubunto
nubunto / build.gradle.kts
Created August 30, 2019 19:14
Gradle Kotlin FatJar
val fatJar = task("fatJar", type = Jar::class) {
baseName = "${project.name}-fat"
manifest {
attributes["Implementation-Title"] = "Gradle Jar File Example"
attributes["Implementation-Version"] = "1.0.0"
attributes["Main-Class"] = "com.ignite.demo.App"
}
from(configurations.runtimeClasspath.get().map({ if (it.isDirectory) it else zipTree(it) }))
with(tasks.jar.get() as CopySpec)
}
@nubunto
nubunto / SqsQueueSpout.java
Created August 5, 2019 04:45
Apache Storm spout implementation for SQS
package com.your.package;
import org.apache.storm.spout.SpoutOutputCollector;
import org.apache.storm.task.TopologyContext;
import org.apache.storm.topology.base.BaseRichSpout;
import org.apache.storm.utils.Utils;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.sqs.SqsClient;
import software.amazon.awssdk.services.sqs.model.*;
@nubunto
nubunto / Main.java
Created August 5, 2019 04:26
Storm Bolts and Spouts example
package com.ifood.connection;
import org.apache.storm.spout.SpoutOutputCollector;
import org.apache.storm.task.OutputCollector;
import org.apache.storm.task.TopologyContext;
import org.apache.storm.topology.ConfigurableTopology;
import org.apache.storm.topology.OutputFieldsDeclarer;
import org.apache.storm.topology.TopologyBuilder;
import org.apache.storm.topology.base.BaseRichBolt;
import org.apache.storm.topology.base.BaseRichSpout;
@nubunto
nubunto / main.go
Created January 2, 2019 19:44
Slack: "no_file_data" error when forgetting to supply the Filename field when using a Reader
package main
import (
"fmt"
"os"
"github.com/nlopes/slack"
)
func main() {
@nubunto
nubunto / application.ex
Created September 24, 2018 19:04
Elixir Portal Application: http://howistart.org
defmodule Portal.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
def start(_type, _args) do
# List all child processes to be supervised
children = [
@nubunto
nubunto / userstyle.css
Created September 8, 2016 13:07
Style to fix Kibana
/* Kibana typeahead is fucked up in Chrome since the lastest update, so this should fix it. */
/* Stylish chrome app URL: https://chrome.google.com/webstore/detail/stylish/fjnbnpbmkenffdnngjfgmeleoegfcffe/related */
/* typeahead css (courtesy from Gareth) */
@-moz-document domain("logs.thermeon.eu") {
.typeahead .typeahead-items {
top: 32px;
}
}
@nubunto
nubunto / response_http.go
Last active July 13, 2016 13:03
Refactored HTTP error handling/response.
package main
import (
"encoding/json"
"errors"
"fmt"
"log"
"net/http"
"time"
@nubunto
nubunto / main.go
Last active July 7, 2016 02:15
Código para o Igão.
package main
import (
"database/sql"
"encoding/json"
"fmt"
"log"
"net/http"
_ "github.com/lib/pq"
@nubunto
nubunto / test.md
Created June 27, 2016 00:57
AST for Go packages.

$ echo 'println("Hello!")' | ./playgo

 0  *ast.File {
     1  .  Package: src.go:1:1
     2  .  Name: *ast.Ident {
     3  .  .  NamePos: src.go:1:9
     4  .  .  Name: "main"
     5  .  }
     6  .  Decls: []ast.Decl (len = 1) {
     7  .  .  0: *ast.FuncDecl {
@nubunto
nubunto / mithril.sibilant
Created March 25, 2015 14:12
mithril's first page example ported to sibilant
(var app {})
(def app.page-list () (m.request {method 'GET url 'pages.json}))
(def app.controller ()
(var pages (app.page-list))
{pages pages rotate (#() (pages.push (pages.shift)))})
(def app.view (ctrl)
[(ctrl.pages.map (#(page) (m "a" {href page.url} page.title))) (m "button" {onclick ctrl.rotate}, "rotate links")])