This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Param Helper (Jed Verity 2011) | |
USAGE | |
Given query = "?foo=bar&oof=rab": | |
query.param('foo') // 'bar' | |
query.param('oof') // 'rab' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
"exec" "twxec" "-e" "rand_ints()" "$0" "$@" | |
import random | |
import gevent | |
def rand_ints(): | |
while True: | |
value = random.randint({{number minval}}, {{number maxval}} + 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
"exec" "twxec" "-e" "average_accrual_rate" "$0" "$@" | |
from dateutil import parser | |
{{docstring "Calculate the average rate at which the user has accrued friends and followers"}} | |
_source = {{string Message_Type ["Twitter", "GNIP"]}} | |
def average_accrual_rate(msg): | |
if _source == "GNIP": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
"exec" "twxec" "-e" "anomaly_detection" "$0" "$@" | |
import json | |
{{ docstring "Given the keys to the values of the average and standard deviation of a distribution, this transform | |
identifies whether the value of a particular variable is an outlier with respect to that distribution. This enrichment returns | |
a user-specified key with an * anomaly * field that contains _True_ or _False_." }} | |
avg_key = {{string Key_name_of_distribution_average_value}} | |
std_key = {{string Key_name_of_distribution_standard_deviation_value}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
"exec" "twxec" "-e" "predict_tweet" "$0" "$@" | |
{{docstring "Predict if a tweet belongs to a category(based on its text) using a pre-built[Supoort Vector Machine](http://en.wikipedia.org/wiki/Support_vector_machine)"}} | |
from trickle.nner.en.nner import tokens as tokenize | |
import numpy as np | |
import csv | |
import importlib | |
import pickle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
"exec" "twxec" "-e" "calc_emas" "$0" "$@" | |
import numpy as np | |
from itertools import count | |
from math import sqrt | |
import time | |
class ExpMovingAvg(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
"exec" "twxec" "-e" "filter_by_language" "$0" "$@" | |
{{docstring "Filter your simplified tweets by the language they're written in. Choose your language from the dropdown box below."}} | |
language = {{string Language ["English", "French", "Arabic", "Japanese", "Spanish", "German", "Italian", "Indonesian", "Portuguese", "Korean", "Turkish", "Russian"]}} | |
language_map = { | |
"English": "en", | |
"French": "fr", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
"exec" "twxec" "-e" "filter_out_retweets" "$0" "$@" | |
{{docstring "Filter out retweets - because if it's not authentic, it's not for you"}} | |
def filter_out_retweets(msg): | |
# Look for both source style as well as transform style | |
# Timbr.io style: | |
if "is_retweet" in msg and msg["is_retweet"]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
"exec" "twxec" "-e" "stream()" "$0" "$@" | |
from trickle.gnip import PowerTrackStream | |
user = {{string User_Name}} | |
account = {{string Account_Name}} | |
password = {{password Account_Password}} | |
config = {{string GNIP_Rules_Configuration}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
"exec" "twxec" "-e" "replay_stream()" "$0" "$@" | |
from trickle.gnip import PowerTrackReplayStream | |
import datetime as dt | |
user = {{string User_Name}} | |
account = {{string Account_Name}} | |
password = {{password Account_Password}} | |
config = {{string GNIP_Configuration}} |
OlderNewer