Skip to content

Instantly share code, notes, and snippets.

View jatrost's full-sized avatar

Jason Trost jatrost

View GitHub Profile
2012-03-02 08:15:25,808 [main] INFO org.apache.pig.Main - Logging error messages to: /home/developer/workspace/accumulo-pig/pig_1330694125807.log
2012-03-02 08:15:25,937 [main] INFO org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to hadoop file system at: hdfs://127.0.0.1/
2012-03-02 08:15:26,032 [main] INFO org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to map-reduce job tracker at: 127.0.0.1:9001
grunt> register /home/developer/workspace/accumulo-pig/lib/accumulo-core-1.5.0-incubating-SNAPSHOT.jar
grunt> register /home/developer/workspace/accumulo-pig/lib/cloudtrace-1.5.0-incubating-SNAPSHOT.jar
grunt> register /home/developer/workspace/accumulo-pig/lib/libthrift-0.6.1.jar
grunt> register /home/developer/workspace/accumulo-pig/lib/zookeeper-3.3.1.jar
grunt> register /home/developer/workspace/accumulo-pig/target/accumulo-pig-1.5.0-incubating-SNAPSHOT.jar
grunt>
$ traceroute 216.81.59.173
traceroute to 216.81.59.173 (216.81.59.173), 30 hops max, 60 byte packets
1 192.168.1.254 (192.168.1.254) 13.813 ms 13.813 ms 13.808 ms
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
#!/usr/bin/python
import sys
import re
lines = sys.stdin.readlines()
num = 1
total = len(lines)
@jatrost
jatrost / recover_jpegs.sh
Last active January 1, 2016 14:59
Recovering JPEGs from seemingly erased SD card
$ sudo dd if=/dev/disk3 of=disk.copy bs=$[1024*1024]
3823+0 records in
3823+0 records out
4008706048 bytes transferred in 534.470609 secs (7500330 bytes/sec)
$ brew install foremost
Warning: A newer Command Line Tools release is available
You should install the latest version from:
https://developer.apple.com/downloads
==> Downloading http://foremost.sourceforge.net/pkg/foremost-1.5.7.tar.gz
@jatrost
jatrost / ExclamationTopology.java
Last active April 18, 2016 19:39
ExclamationTopology instrumented with Metrics collection.
package storm.starter;
import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.StormSubmitter;
import backtype.storm.metric.LoggingMetricsConsumer;
import backtype.storm.metric.api.CountMetric;
import backtype.storm.metric.api.MeanReducer;
import backtype.storm.metric.api.MultiCountMetric;
import backtype.storm.metric.api.ReducedMetric;
@jatrost
jatrost / ExclamationTopology.diff
Last active January 2, 2016 07:09
Additions to ExclamationTopology needed for metrics collection.
diff --git a/src/jvm/storm/starter/ExclamationTopology.java b/src/jvm/storm/starter/ExclamationTopology.java
index fed8b1e..db5a03f 100644
--- a/src/jvm/storm/starter/ExclamationTopology.java
+++ b/src/jvm/storm/starter/ExclamationTopology.java
@@ -3,6 +3,11 @@ package storm.starter;
import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.StormSubmitter;
+import backtype.storm.metric.LoggingMetricsConsumer;
+import backtype.storm.metric.api.CountMetric;
transient CountMetric _countMetric;
transient MultiCountMetric _wordCountMetric;
transient ReducedMetric _wordLengthMeanMetric;
@Override
public void prepare(Map conf, TopologyContext context, OutputCollector collector) {
_collector = collector;
initMetrics(context);
}
void initMetrics(TopologyContext context)
{
_countMetric = new CountMetric();
_wordCountMetric = new MultiCountMetric();
@Override
public void execute(Tuple tuple) {
_collector.emit(tuple, new Values(tuple.getString(0) + "!!!"));
_collector.ack(tuple);
updateMetrics(tuple.getString(0));
}
void updateMetrics(String word)
{
conf.registerMetricsConsumer(LoggingMetricsConsumer.class, 2);