Skip to content

Instantly share code, notes, and snippets.

View primaryobjects's full-sized avatar

Kory Becker primaryobjects

View GitHub Profile
@primaryobjects
primaryobjects / forever.md
Last active December 21, 2017 01:02
forever path notes
@primaryobjects
primaryobjects / 1-promise.js
Created December 16, 2017 02:34
A promise chain with setTimeout in javascript.
// Demo http://jsbin.com/qevetiqavu/edit?js,output
var one = function(i) {
return new Promise((resolve, reject) => {
setTimeout(() => {
console.log(`setTimeout ${i}`);
if (i < 0) {
reject(i);
}
else if (i >= 5) {
@primaryobjects
primaryobjects / quote.R
Last active January 10, 2018 16:30
Retrieving a stock quote price in R. Uses getURL, proxy, scrape, yahoo, finance.
require(XML)
require(stringr)
library(RCurl)
# The ticker symbols to get price quotes.
names <- c('SPY', 'EFA', 'AGG')
# Read current stock prices.
prices <- t(sapply(names, function(name) {
webpage <- getURL(paste0('https://finance.yahoo.com/quote/', name), .opts = list(ssl.verifypeer = FALSE))
@primaryobjects
primaryobjects / bigdata.md
Last active December 12, 2017 18:59
Big Data and Quant Panel

12-06-2017

Speaker: Kory Becker

Question: The increasing availability of data seems to have had a big impact on quantitative finance. As an engineer, would you say this is what we would call "big data"?

It’s a very exciting time to be a technologist right now. The term “big data” is really more of a media concept, often mentioned in combination with machine learning and AI. It’s really about more than just the size of the data itself – it’s also about the insight that can be collected from it.

Only in the past few years have we seen such as explosion of data availability from a variety of sources. Computers used to be relatively silo-ed, but now we have an enormous amount of data coming from places like social networking services, biometric screening devices, home automation suites, and new sources every day.

@primaryobjects
primaryobjects / m3u8.md
Last active September 18, 2026 23:54
How to download m3u8 and ts video movie streams.

m3u8 Downloading

  1. Open Chrome Developer tools and click the Network tab.
  2. Navigate to the page with the video and get it to start playing.
  3. Filter the list of files to "m3u8".
  4. Find master.m3u8 or index.m3u8 and click on it.
  5. Save the file to disk and look inside it.
  6. If the file contains a single m3u8 master url, copy that one instead.
  7. Run the program m3u8x.
  8. Paste the same m3u8 url in both textboxes (URL and Quality URL) and click "Headers" and set the referral url and user-agent from the request as found in Chrome.
@primaryobjects
primaryobjects / clone.py
Created November 28, 2017 03:48
RabbitVcs clone.py clipboard default
from __future__ import absolute_import
#
# This is an extension to the Nautilus file manager to allow better
# integration with the Subversion source control system.
#
# Copyright (C) 2006-2008 by Jason Field <jason@jasonfield.com>
# Copyright (C) 2007-2008 by Bruce van der Kooij <brucevdkooij@gmail.com>
# Copyright (C) 2008-2010 by Adam Plumb <adamplumb@gmail.com>
#
# RabbitVCS is free software; you can redistribute it and/or modify
@primaryobjects
primaryobjects / color.js
Last active November 16, 2017 17:55
Easy Auto Refresh scripts that run upon each refresh. Print "Hello World" to the browser console. Change the web page color. And a lot more!
document.querySelector('body');
function getRandomColor() {
var letters = '0123456789ABCDEF';
var color = '#';
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
#
# [2017-10-16] Challenge #336 [Easy] Cannibal numbers
# https: https://www.reddit.com/r/dailyprogrammer/comments/76qk58/20171016_challenge_336_easy_cannibal_numbers/
#
# Demo at http://www.r-fiddle.org/#/fiddle?id=xqqeOaS1&version=2
#
# Imagine a given set of numbers wherein some are cannibals.
# We define a cannibal as a larger number can eat a smaller number and increase its value by 1.
# There are no restrictions on how many numbers any given number can consume.
# A number which has been consumed is no longer available.
@primaryobjects
primaryobjects / react-confirm.js
Created November 1, 2017 19:03
A simple example of a confirm alert dialog in ReactJs / React.
<div className='delete-button' onClick={() => { if (window.confirm('Are you sure you wish to delete this item?')) this.onCancel(item) } } />
//
// [2017-10-09] Challenge #335 [Easy] Consecutive Distance Rating
// https://www.reddit.com/r/dailyprogrammer/comments/759fha/20171009_challenge_335_easy_consecutive_distance/
//
// Demo at http://jsbin.com/kipepoyuba/edit?js,output
//
// We'll call the consecutive distance rating of an integer sequence the sum of the distances between consecutive integers.
// Consider the sequence 1 7 2 11 8 34 3. 1 and 2 are consecutive integers, but their distance apart in the sequence is 2.
// 2 and 3 are consecutive integers, and their distance is 4.
// The distance between 7 and 8 is 3. The sum of these distances is 9.