Skip to content

Instantly share code, notes, and snippets.

@zupzup
zupzup / main.go
Created March 20, 2017 10:03
Go TCP Proxy / Port Forwarding Example (https://zupzup.org/go-port-forwarding/)
package main
import (
"flag"
"fmt"
"io"
"log"
"net"
"os"
"os/signal"
@zupzup
zupzup / main.go
Created July 14, 2017 12:46
Example for Basic AST Traversal in Go
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/printer"
"go/token"
"log"
"os"
// This file is an automatically generated Go binding. Do not modify as any
// change will likely be lost upon the next re-generation!
package main
import (
"math/big"
"strings"
"github.com/ethereum/go-ethereum/accounts/abi"
@zupzup
zupzup / main.go
Last active April 2, 2024 15:17
ElasticSearch to Prometheus Exporter in Go
package main
import (
"context"
"github.com/go-chi/chi"
"github.com/go-chi/render"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
log "github.com/sirupsen/logrus"
"gopkg.in/olivere/elastic.v6"
@zupzup
zupzup / main.go
Created September 15, 2018 14:17
Log deletion script for ELK-stack logs written in Go
package main
import (
"context"
"flag"
log "github.com/sirupsen/logrus"
"gopkg.in/olivere/elastic.v6"
"os"
"strings"
"time"
@zupzup
zupzup / app.rs
Created March 18, 2020 14:46
test gist
#[derive(Clone)]
pub struct JobContext {
pub db_pool: DBPool,
pub redis_pool: RedisPool,
}
pub trait Job {
fn run(&self, ctx: &JobContext) -> JobResult;
fn get_interval(&self) -> Duration;
fn get_name(&self) -> &'static str;
@zupzup
zupzup / some_file.rs
Created March 18, 2020 14:53
some_gist
#[derive(Clone)]
pub struct JobContext {
pub db_pool: DBPool,
pub redis_pool: RedisPool,
}
pub trait Job {
fn run(&self, ctx: &JobContext) -> JobResult;
fn get_interval(&self) -> Duration;
fn get_name(&self) -> &'static str;
@zupzup
zupzup / container-juggler.yml
Created May 26, 2020 14:13
container juggler examples
templateFolderPath: ./templates/
scenarios:
auth:
- redis
- auth-db
- auth-service
@zupzup
zupzup / container-juggler.yml
Created May 26, 2020 14:15
container-juggler yml example
templateFolderPath: ./templates/
scenarios:
auth:
- redis
- auth-db
- auth-service
auth-service:
extra_hosts:
- other-service:192.168.8.110
- other-service-db:192.168.8.110
...