Skip to content

Instantly share code, notes, and snippets.

View pteich's full-sized avatar

Peter pteich

View GitHub Profile
@pteich
pteich / main.go
Last active March 25, 2024 21:50
Example for using go's sync.errgroup together with signal detection signal.NotifyContext to stop all running goroutines
package main
import (
"context"
"errors"
"fmt"
"os/signal"
"syscall"
"time"

Keybase proof

I hereby claim:

  • I am pteich on github.
  • I am pteich (https://keybase.io/pteich) on keybase.
  • I have a public key ASCLynuk3IisbBsZktWF5fB9yF3mP1zgsv2aKsGNdR-Cvwo

To claim this, I am signing this object:

@pteich
pteich / Dockerfile
Created July 12, 2016 12:50
Tomcat Dockerfile Description
FROM tomcat:7-jre8-alpine
MAINTAINER Peter Teich <peter.teich@gmail.com>
# mit RUN werden beim Bauen des Image Shell-Befehle IM Container ausgeführt
# möglichst viele Befehle miteinmal ausführen, da nach jedem RUN ein neuer Layer im Container gespeichert wird
# Beispiel:
# RUN apt-get update && apt-get install -y build-essential curl && \
# apt-get clean && \
# rm -rf /var/lib/apt/lists/* && \
@pteich
pteich / request_wowzalisteners.go
Last active November 2, 2015 16:01
Request Wowza Stream Listeners
package main
import (
"encoding/xml"
"fmt"
"io/ioutil"
"net/http"
"net/url"
httpDigestAuth "github.com/pteich/http-digest-auth-client"
@pteich
pteich / request_icecastlisteners.go
Last active January 16, 2021 18:35
Request Listeners Stats from Icecast
package main
import (
"bytes"
"encoding/xml"
"fmt"
"io/ioutil"
"net/http"
"time"
)
@pteich
pteich / gist:8d43ed6dadfaa74b8b6e
Last active August 29, 2015 14:18
Fluentd Icecast input with request line split
Regex:
^(?<host>[^ ]*) (?<logname>[^ ]*) (?<user>[^ ]*) \[(?<time>[^\]]*)\] \"GET (?<request_uri>[^\?]+)\?(?<request_args>[^ ]*) (?<request_protocol>[^ ]*)\" (?<response>[^ ]*) (?<bytes>[^ ]*) \"(?<referrer>[^\"]*)\" \"(?<agent>[^\"]*)\" (?<duration>[^ ]*)
Time Format:
%d/%b/%Y:%H:%M:%S %z
fluent.conf
<source>
type tail
path /var/log/foo/bar.log
@pteich
pteich / .htaccess
Last active August 29, 2015 14:08
Apache Redirect non www to www subdomain (httpd.conf or .htaccess)
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(?!www\.)(.+) [NC]
RewriteRule ^(.*) http://www.%1$1 [R=301,NE,L]
@pteich
pteich / bootstrap.sh
Created October 22, 2014 14:15
Bootstrap to setup up Vagrant Ubuntu Box with Apache, PHP, ElasticSearch, Beanstalkd and Beanstalk workers via Supervisord
#!/usr/bin/env bash
sudo apt-get install mc -y
wget -qO - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb http://packages.elasticsearch.org/elasticsearch/1.3/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch.list
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
sudo apt-get install elasticsearch -y
sudo apt-get install php5-curl -y
sudo /usr/share/elasticsearch/bin/plugin -install mobz/elasticsearch-head