Skip to content

Instantly share code, notes, and snippets.

John Beppu beppu

Block or report user

Report or block beppu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View t3.json
{
"created_at": "Mon Jan 01 16:02:46 +0000 2018",
"id": 947860662130110500,
"id_str": "947860662130110464",
"text": "Coin of the week; https://t.co/p55OUIL9qC",
"display_text_range": [
0,
17
],
"source": "<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>",
View bot-output.txt
Tue Dec 26 13:59:51 +0000 2017 | officialmcafee 961445378 | Coin Of The Day: https://t.co/WSTXaha1Nk
[ 'Coin Of The Day: https',
'https',
index: 0,
input: 'Coin Of The Day: https://t.co/WSTXaha1Nk' ]
COIN OF THE DAY! Coin Of The Day: https://t.co/WSTXaha1Nk { found: false,
reason: 'Couldn\'t find https in currencies list.' }
{ found: false,
reason: 'Couldn\'t find https in currencies list.' }
View bot-output.txt
Mon Dec 25 13:59:59 +0000 2017 | officialmcafee 961445378 | Coin of the day: Humaniq (HMQ). In the spirit of Christmas, there is no better coin. Their mission is true to the v… https://t.co/aPoKRqBcqR
[ 'Coin of the day: Humaniq ',
'Humaniq ',
index: 0,
input: 'Coin of the day: Humaniq (HMQ). In the spirit of Christmas, there is no better coin. Their mission is true to the v… https://t.co/aPoKRqBcqR' ]
COIN OF THE DAY! Coin of the day: Humaniq (HMQ). In the spirit of Christmas, there is no better coin. Their mission is true to the v… https://t.co/aPoKRqBcqR { found: true, symbol: 'HMQ', name: 'Humaniq' }
attempting to buy HMQ
{ success: true,
message: '',
result:
View session.txt
$ bin/repl
> bot.btcSpend
0.001
> bot.btcSpend = 0.25
0.25
> bot.adjustment = 0.05
0.05
> bot.init()
Promise {
undefined,
@beppu
beppu / FileSaver.min.js
Last active Dec 8, 2016
Using FileSaver
View FileSaver.min.js
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
var saveAs=saveAs||function(e){"use strict";if(typeof e==="undefined"||typeof navigator!=="undefined"&&/MSIE [1-9]\./.test(navigator.userAgent)){return}var t=e.document,n=function(){return e.URL||e.webkitURL||e},r=t.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in r,a=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},i=/constructor/i.test(e.HTMLElement)||e.safari,f=/CriOS\/[\d]+/.test(navigator.userAgent),u=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},s="application/octet-stream",d=1e3*40,c=function(e){var t=function(){if(typeof e==="string"){n().revokeObjectURL(e)}else{e.remove()}};setTimeout(t,d)},l=function(e,t,n){t=[].concat(t);var r=t.length;while(r--){var o=e["on"+t[r]];if(typeof o==="function"){try{o.call(e,n||e)}catch(a){u(a)}}}},p=function(e){if(/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)){return new Blob([String.fromChar
View realtime-analytics.org

https://www.youtube.com/watch?v=fZGlmVMdKDs

Building Realtime Analytics Systems

Finding a solution

(Initially you might think…) Load all your data into Hadoop. Query it. Done

MapReduce/Hadoop has problems. It can be slow.

Not optimized for query latency

Need to introduce a query layer to make queries faster.

Making Queries Faster

What types of queries to optimize for?

View cold-timestamp
#!/usr/bin/env perl
use strict;
use warnings;
use JSON;
while (<>) {
my $relay = decode_json $_;
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(int($relay->{coldTimestamp} / 1000));
my $date = sprintf('%d-%02d-%02d', $year+1900, $mon+1, $mday);
print "$date $_"
@beppu
beppu / shell
Created Jul 4, 2015
an example of how to control a subprocess and communicate with it through stdin/stdout/stderr
View shell
#!/usr/bin/env perl
use strict;
use warnings;
use IPC::Open3;
use IO::Select;
use Symbol qw(gensym);
use POSIX qw(:sys_wait_h);
# Read as much as possible from a file handle and return the result.
#
@beppu
beppu / emit-error-catch.ls
Created Apr 21, 2015
my most recent take on taming EventEmitter
View emit-error-catch.ls
events = require \events
EventEmitter = events.EventEmitter
P = require \bluebird
fifo = require \./app/shared/fifo
q = fifo.make!
ee = new EventEmitter
chain = P.resolve(true)
set-timeout (-> ee.emit \error, { +aaaa }), 500ms
@beppu
beppu / random-replace
Created Feb 27, 2015
for educational purposes
View random-replace
#!/usr/bin/perl
use strict;
use warnings;
sub slurp {
my $file = shift;
open my $fh, '<', $file or die;
my @lines = <$fh>;
close $fh;
\@lines;
You can’t perform that action at this time.