Skip to content

Instantly share code, notes, and snippets.

rick tait rickt

Block or report user

Report or block rickt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View td-agent.conf
#
# Example fluentd config file for nginx access log injection into Google Bigquery
# collecting nginx access log
<source>
@type tail
tag accesslogs-rickts-dev-box
path /var/log/nginx/access.log
format apache
buffer_type file
@rickt
rickt / bzip-inline-decompress.go
Last active May 6, 2019
HOW-TO: inline-decompress a .bz2 file with Go
View bzip-inline-decompress.go
package main
import (
"bufio"
"compress/bzip2"
"fmt"
"io"
"os"
)
View gsuitemdmtool.go
package main
// https://rickt.org/2019/01/08/playing-with-g-suite-mdm-mobile-device-data-using-go/
import (
"context"
"errors"
"flag"
"fmt"
"github.com/dustin/go-humanize"
View main.py
import os
from google.cloud import bigquery
def csv_loader(data, context):
client = bigquery.Client()
dataset_id = os.environ['DATASET']
dataset_ref = client.dataset(dataset_id)
job_config = bigquery.LoadJobConfig()
job_config.schema = [
bigquery.SchemaField('id', 'INTEGER'),
@rickt
rickt / analyticsdumper.go
Last active Jan 8, 2019
example Go code showing how to download reporting data from Google Analytics using the Core Reporting API, a Google service account + oauth2 (UPDATE: go here http://code.rickt.org/post/142445693275/updated-golang-code-to-query-ga-data-via-the instead)
View analyticsdumper.go
package main
import (
"fmt"
"golang.org/x/oauth2"
"golang.org/x/oauth2/jwt"
"google.golang.org/api/analytics/v3"
"io/ioutil"
"log"
"time"
@rickt
rickt / slackweatherbot.go
Created Aug 20, 2018
A weatherbot for Slack written in go
View slackweatherbot.go
package slackweatherbot
import (
owm "github.com/briandowns/openweathermap"
"golang.org/x/net/context"
"google.golang.org/appengine"
"google.golang.org/appengine/log"
"google.golang.org/appengine/urlfetch"
"net/http"
"os"
@rickt
rickt / slackaccessloglooker.go
Created Aug 5, 2016
call the slack team.accessLogs API to output which of your Slack users are not using a desktop or mobile Slack app
View slackaccessloglooker.go
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"strings"
"time"
)
@rickt
rickt / analytics-dumper.go
Last active Apr 8, 2016
example Go code showing how to download reporting data from Google Analytics using the Core Reporting API (updated 2015)
View analytics-dumper.go
//
// EDIT: this code is now old
// i have recently (april 2016) updated it to use the new golang.org/x/oauth2 lib
// you can get the new analytics dumper at the below url:
// https://gist.github.com/rickt/d839564155cac15d59b6027668d8cb64
//
package main
import (
@rickt
rickt / slackminisniffer.go
Created Mar 5, 2016
slack mini "sniffer", connects to slack and outputs the messages received over the slack websocket
View slackminisniffer.go
package main
import (
"fmt"
"github.com/nlopes/slack"
)
func main() {
// create new slack object & connect
api := slack.New("TOKEN_REDACTED")
api.SetDebug(true)
rtm := api.NewRTM()
@rickt
rickt / japan-timebot-simple.go
Last active Mar 4, 2016
simple appengine go app that prints out the current time in Japan, Los Angeles & London/UTC
View japan-timebot-simple.go
// http://japan-timebot-simple.appspot.com
package japantime
import (
"fmt"
"net/http"
"time"
)
You can’t perform that action at this time.