Create a FlameGraph to visualize where your code is spending its time.
Requires plop and FlameGraph.
// | |
// NSObject+setValuesForKeysWithJSONDictionary.h | |
// SafeSetDemo | |
// | |
// Created by Tom Harrington on 12/29/11. | |
// Copyright (c) 2011 Atomic Bird, LLC. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
#!/usr/bin/python | |
import time | |
import datetime | |
import random | |
timestr = time.strftime("%Y%m%d-%H%M%S") | |
f = open('access_log_'+timestr+'.log','w') | |
ips=["123.221.14.56","16.180.70.237","10.182.189.79","218.193.16.244","198.122.118.164","114.214.178.92","233.192.62.103","244.157.45.12","81.73.150.239","237.43.24.118"] | |
referers=["-","http://www.casualcyclist.com","http://bestcyclingreviews.com/top_online_shops","http://bleater.com","http://searchengine.com"] |
Create a FlameGraph to visualize where your code is spending its time.
Requires plop and FlameGraph.
//================================================================== | |
// SPARK INSTRUMENTATION | |
//================================================================== | |
import com.codahale.metrics.{MetricRegistry, Meter, Gauge} | |
import org.apache.spark.{SparkEnv, Accumulator} | |
import org.apache.spark.metrics.source.Source | |
import org.joda.time.DateTime | |
import scala.collection.mutable |
package mapreduce | |
/** | |
* This is an attempt to find a minimal set of type classes that describe the map-reduce programming model | |
* (the underlying model of Google map/reduce, Hadoop, Spark and others) | |
* The idea is to have: | |
* 1) lawful types that fully constrain correctness | |
* 2) a minimal set of laws (i.e. we can't remove any laws, | |
* 3) able to fully express existing map/reduce in terms of these types | |
* |
package main | |
import ( | |
"fmt" | |
"io" | |
"io/ioutil" | |
"net" | |
"os" | |
"strings" |
#!/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 |
#!/bin/bash | |
set -euo pipefail | |
usage() { | |
echo "usage: $0 <repo> <name>" | |
echo | |
echo "<repo>" | |
echo " The repo link, e.g. https://github.com/m3db/m3coordinator.git" | |
echo |
#!/usr/bin/env bash | |
while getopts "d" opt; do | |
case $opt in | |
d) dryRunOpt="--dry-run";; | |
esac | |
done | |
# prune local "cache" of remote branches first: | |
git fetch --prune origin | |
# delete merged to master branches: |
Custom format for displaying bytes as kb
, mb
, gb
or tb
.
Response to a few places on the internet: https://productforums.google.com/forum/#!topic/docs/x_T_N-yRUYg And here: https://stackoverflow.com/questions/1533811/how-can-i-format-bytes-a-cell-in-excel-as-kb-mb-gb-etc
Here is one that I have been using:
[<1000000]0.00," KB";[<1000000000]0.00,," MB";0.00,,," GB"