Instantly share code, notes, and snippets.

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
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"
View slackaccessloglooker.go
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"strings"
"time"
)
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"
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()
View japan-timebot-simple.go
// http://japan-timebot-simple.appspot.com
package japantime
import (
"fmt"
"net/http"
"time"
)
View query-arma3-server.go
package main
import (
"flag"
"fmt"
steam "github.com/kidoman/go-steam"
"sort"
)
var addresses = []string{
View displaytimeindifftz.go
package main
import (
"fmt"
"time"
)
const (
datelayout string = "2006-01-02 15:04:05"
)