Skip to content

Instantly share code, notes, and snippets.

View yiwang's full-sized avatar

Yi Wang yiwang

View GitHub Profile
Originally:
https://gist.github.com/7565976a89d5da1511ce
Hi Donald (and Martin),
Thanks for pinging me; it's nice to know Typesafe is keeping tabs on this, and I
appreciate the tone. This is a Yegge-long response, but given that you and
Martin are the two people best-situated to do anything about this, I'd rather
err on the side of giving you too much to think about. I realize I'm being very
critical of something in which you've invested a great deal (both financially

How to make your R code faster

Making your code faster is requires balancing short-term and long-term goals. If you only spend time making your existing code faster, you'll never get any new work done, but if you don't spend any time thinking about inefficient code you'll waste time computing that you could have reduced with a little more knowledge. Below I make three broad recommendations on how to make your R code faster, based on whether you want a pay off in the short, medium or long term.

In the short term, you'll get the most bang for your buck by learning how to write better R code. Patrick Burns' The R inferno is a great place to learn about the most common performance mistakes and how to avoid them. I also like Norm Matloff's The Art of R programming, and I have my own hat in the ring with Advanced R programming. Apart from books, asking and answering questions on [stackoverflow](h

Tuning Storm+Trident

Tuning a dataflow system is easy:

The First Rule of Dataflow Tuning:
* Ensure each stage is always ready to accept records, and
* Deliver each processed record promptly to its destination
alias gdbnew='/usr/local/Cellar/gdb/7.6/bin/gdb'
// Copyright 2014 BrightTag, Inc. All rights reserved.
package com.brighttag.storm.utils;
import backtype.storm.tuple.Values;
import storm.trident.operation.BaseFunction;
import storm.trident.operation.TridentCollector;
import storm.trident.tuple.TridentTuple;
/**
* Converts the first tuple from a byte array into a string.
/**
* Javascript port of Clojure's flavor of Murmur3.
* See https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Murmur3.java
*
* Find at: https://gist.github.com/favila/9088146
* By favila (Francis Avila) 2014-02-19
*/
goog.provide('cljs.lang.murmur3');
goog.require('cljs.core');
-- Related blog post to this Gist:
-- https://torsten.io/stdout/expanding-json-arrays-to-rows
-- Run these commands on a interactive RedShift session:
CREATE TEMP TABLE clusters AS (
SELECT 1 AS id, '[1, 2]' AS node_sizes UNION ALL
SELECT 2 AS id, '[5, 1, 3]' AS node_sizes UNION ALL
SELECT 3 AS id, '[2]' AS node_sizes
);
VIM and Clojure:
The current steps might be (intended for vim beginners).
0A. Install Pathogen for easy vim installation (optional)
- https://github.com/tpope/vim-pathogen
- http://www.vim.org/scripts/script.php?script_id=2332
0B. Install new version of static runtime editing (optional, only if latest version is needed)
- https://github.com/guns/vim-clojure-static
#!/bin/bash -ex
# Paste this into ssh
# curl -sL https://gist.github.com/andsens/2913223/raw/bootstrap_homeshick.sh | tar -xzO | /bin/bash -ex
# When forking, you can get the URL from the raw (<>) button.
### Set some command variables depending on whether we are root or not ###
# This assumes you use a debian derivate, replace with yum, pacman etc.
aptget='sudo apt-get'
chsh='sudo chsh'