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 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'),
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 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 / 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 / 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 / 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"
)
@rickt
rickt / query-arma3-server.go
Last active Aug 29, 2015
example Go code to pull stats from an Arma 3 server via the RCON protocol
View query-arma3-server.go
package main
import (
"flag"
"fmt"
steam "github.com/kidoman/go-steam"
"sort"
)
var addresses = []string{
@rickt
rickt / displaytimeindifftz.go
Created Jul 14, 2014
example go code to load/print a time in another TZ
View displaytimeindifftz.go
package main
import (
"fmt"
"time"
)
const (
datelayout string = "2006-01-02 15:04:05"
)
You can’t perform that action at this time.