Create a FlameGraph to visualize where your code is spending its time.
Requires plop and FlameGraph.
| // Package test contains utility methods for testing. | |
| package test | |
| import ( | |
| "fmt" | |
| "testing" | |
| "github.com/golang/mock/gomock" | |
| ) |
| #!/bin/bash | |
| if ! [ -x "$(command -v git)" ]; then | |
| echo 'Error: git is not installed.' >&2 | |
| exit 1 | |
| fi | |
| if ! [ -x "$(command -v dot)" ]; then | |
| echo 'Error: graphviz (dot) is not installed.' >&2 | |
| exit 1 | |
| fi |
| package importlint | |
| import ( | |
| "go/ast" | |
| "go/token" | |
| ) | |
| // NB(prateek): http://goast.yuroyoro.net/ is enormously helpful. | |
| // importDecl is the collection of importGroups contained in a single import block. |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import sys | |
| import argparse | |
| import operator | |
| from collections import defaultdict | |
| import re | |
| def parseFile(f): | |
| with open(f, 'r') as opened: |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # | |
| # golang_import_order_cleaner.py: cleans up import orders in golang files per the m3db convention | |
| # | |
| # Warning: This is very much alpha, take a backup of your files (e.g. commit to git) before running this. | |
| # | |
| # example usage: | |
| # (1) Update all *.go files in the local directory (except vendor/), in-place | |
| # $ golang_import_order_cleaner.py -o inplace |
| // function to get list of files in a directory, recursively | |
| getFileList := func(path string) map[string]struct{} { | |
| fileList := make(map[string]struct{}) | |
| err = filepath.Walk(path, func(path string, f os.FileInfo, err error) error { | |
| fileList[path] = struct{}{} | |
| return nil | |
| }) | |
| require.NoError(t, err) | |
| return fileList |
| package main | |
| import ( | |
| "fmt" | |
| "io" | |
| "io/ioutil" | |
| "net" | |
| "os" | |
| "strings" |
Create a FlameGraph to visualize where your code is spending its time.
Requires plop and FlameGraph.
| // once upon a time, what did I see, but two RDDs | |
| val tableA = sc.parallelize(List((1,2), (3,4), (5,6))) | |
| val tableB = sc.parallelize(List((1,'A'), (3,'B'), (5,'C'))) | |
| // one of them small enough to fit into map | |
| val mapTableB = tableB.collectAsMap | |
| // which everyone could read | |
| val broadcastB = sc.broadcast(mapTableB) | |
| // and join for all eternity | |
| val mapJoin = tableA.map({case (id, value) => (id, value, broadcastB.value.get(id))}) | |
| // q.e.d. |
| /** | |
| * Created by prungta on 7/22/15. | |
| */ | |
| import org.apache.oozie.client.AuthOozieClient; | |
| import org.apache.oozie.client.OozieClient; | |
| import org.apache.oozie.client.OozieClientException; | |
| import org.apache.oozie.client.WorkflowJob; | |
| import javax.security.auth.Subject; | |
| import javax.security.auth.login.AppConfigurationEntry; |