Skip to content

Instantly share code, notes, and snippets.

View jiminoc's full-sized avatar

Jim Plush jiminoc

View GitHub Profile
override def next : Option[Job] = {
println("I FINISHED PROCESSING!")
None
}
override def next : Option[Job] = {
log.info("I FINISHED PROCESSING!")
val results = Tsv(outputdir).readAtSubmitter[String].foreach(line => {
log.info("LINE: " + line)
})
None
}
jim@localhost: ~/temp
➺ fab stats -H 100.100.1.113,100.100.2.220 -P -f fab-count.py
[100.100.1.113] Executing task 'stats'
[100.100.1.113] Executing task 'get_stats'
[100.100.2.220] Executing task 'get_stats'
[100.100.2.220] sudo: lsof -i -sTCP:ESTABLISHED | wc -l
[100.100.1.113] sudo: lsof -i -sTCP:ESTABLISHED | wc -l
[100.100.2.220] out: 36
[100.100.2.220] out:
jim@ubuntu:~/Code/projects/go-lang-idea-plugin$ ant -f build-package.xml
Buildfile: /home/jim/Code/projects/go-lang-idea-plugin/build-package.xml
clean:
[delete] Deleting directory /home/jim/Code/projects/go-lang-idea-plugin/build
init:
[mkdir] Created dir: /home/jim/Code/projects/go-lang-idea-plugin/build
[mkdir] Created dir: /home/jim/Code/projects/go-lang-idea-plugin/dist
[echo] Using IDEA build from: /home/jim/Downloads/idea-IC-135.1289
jim@ubuntu:~/Code/projects/go-lang-idea-plugin$ ant -f build-package.xml
Buildfile: /home/jim/Code/projects/go-lang-idea-plugin/build-package.xml
clean:
[delete] Deleting directory /home/jim/Code/projects/go-lang-idea-plugin/build
init:
[mkdir] Created dir: /home/jim/Code/projects/go-lang-idea-plugin/build
[echo] Using IDEA build from: /home/jim/Downloads/idea-IC-138.2458.8
// check to see if we've already sent this alert recently
func alreadySentRecently(res reservation) bool {
timeNow := time.Now().UTC()
mapKey := res.App + res.Component
waitForNotifyTime := time.Duration(cfg.Main.HoursBetweenAlerts) * time.Hour
_, ok := sentAlerts[mapKey]
if !ok {
sentAlerts[mapKey] = timeNow
l.info("Sending new alert for [%s/%s]", res.App, res.Component)
public void testThatDifferentRPCandHttpPortsAreOK()
throws IOException {
Configuration conf = new HdfsConfiguration();
FileSystem.setDefaultUri(conf, "hdfs://localhost:8000");
conf.set(DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY, "127.0.0.1:9000");
try {
NameNode nameNode = new NameNode(conf); // should be OK!
} catch (Exception e) {
@jiminoc
jiminoc / schema.pig
Created August 12, 2011 16:25
Example of a Pig import Macro
-- Data would be in the following format
-- 2011-01-01^pageview^http://somesite.com/url1^randomuserid123
DEFINE grvschema(inputdata)
returns BEACONS {
$BEACONS = LOAD '$inputdata' USING PigStorage('^') as (date:chararray, action:chararray, url:chararray, userId:chararray);
};
@jiminoc
jiminoc / uniques.pig
Created August 12, 2011 16:29
import macro and calculate uniques
-- Set the default number of reducers for this script
set default_parallel 15;
set job.name unique_users
-- INCLUDE THE OFFICIAL SCHEMA, beacons will be a relation returned
IMPORT 'schema.pig';
beacons = grvschema('$input');
fb = FOREACH beacons GENERATE userGuid;
@jiminoc
jiminoc / loanpattern.scala
Created September 16, 2011 17:21
Example of the loan pattern in Scala
/**
* here we're going to test the loan pattern using something we do all the time, iterate over files and work with
* the lines in those files. Java makes it a pain the arse to just read simple lines in a file, lots of set up
* code and resource management. The nice part of this pattern is once you create that set up code once you can
* use a nice clean API like the one seen below.
* You can see here we're passing in a function to "withFileIterator that accepts a "line" string, we then can
* work on that line string freely and the resource will be closed in a finally block behind the scenes.
*/
@Test
def loanPatternWithFileIterator() {