Stalk vibrates when your stocks fall too fast
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
import { parse } from 'node-html-parser'; | |
import fetch from 'node-fetch'; | |
export default async (location) => { | |
try { | |
const page = await fetch(`https://19hz.info/eventlisting_${location}.php`); | |
const parsed = parse(await page.text()); | |
const rows = parsed.querySelector('tbody').childNodes.slice(1).map(tr => tr.childNodes); | |
const shows = rows | |
.map(row => row.map(td => td.childNodes.reduce((prev, curr) => prev + curr.rawText, ''))) |
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
// You can set the strictness of the test suite by passing "loose", "normal", | |
// or "severe" as the first command-line argument to this Test class. | |
// If no level is passed, it defaults to NORMAL. | |
// | |
// LOOSE => always warn i.e. don't throw an exception to stop testing on first error | |
// NORMAL => throw an exception when a requirement is failed and a warning when a suggestion is found | |
// SEVERE => always throw an exception, treating warnings as errors | |
enum Strictness { | |
LOOSE, NORMAL, SEVERE | |
} |
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
import tensorflow as tf | |
weights = tf.Variable([1., 2., 3.],tf.float32) | |
biases = tf.Variable([4., 5., 6.], tf.float32) | |
x = tf.placeholder(tf.float32) | |
sess = tf.Session() | |
linear_model = weights * x + biases |
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
import numpy as np | |
from random import shuffle | |
from math import sqrt | |
sigmoid = lambda z: 1 / (1 + np.exp(-z)) | |
sigmoidprime = lambda z: sigmoid(z) * (1 - sigmoid(z)) # derivate of sigmoid function | |
def chunk(array, n): | |
chunks = [] | |
for i in xrange(0, len(array), n): |
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
from collections import namedtuple | |
Point = namedtuple("Point", ["x", "y"]) # Point(1, 2).x == 1 and Point(1, 2).y == 2 | |
mean = lambda values: sum(values) / len(values) | |
class Regression(object): | |
def __init__(self, points): | |
self.slope = 0 # we'll use gradient descent to find this | |
self.point = Point(0, 0) # we'll use that stat fact to recalculate this | |
self.learn_from_data_set(points) |
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
// Array with all gpas | |
const gradeNodes = [document.getElementById('grade1')]; | |
const grades = []; | |
// Create click event listeners for each gpa | |
gradeNodes.forEach((gradeNode, i) => { | |
gradeNode.addEventListener("click", () => { | |
gradeNodes[i].innerHTML = `<input value="${grades[i]}" id="${i}" />` | |
}); | |
}); |
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
#!/usr/local/bin/python3 | |
# can run a regresion on a set of points | |
from collections import namedtuple | |
from random import random, choice | |
identity = lambda x: x | |
average = lambda values, key=identity: sum(key(value) for value in values) / len(values) | |
median = lambda values, key=identity: sorted(values, key=key)[len(values) // 2] # close enough |
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
# import modules needed to send emails | |
import smtplib | |
from getpass import getpass | |
# sends a message to the recipient_email | |
def send(recipient_email, message): | |
if not ("@" in recipient_email): | |
raise Exception("Must have an @ in an email address") | |
try: |
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
var Horseman = require('node-horseman'); | |
var request = require("request"); | |
var horseman = new Horseman(); | |
var timesHit = 0; | |
var title = "Shrek"; | |
var url = "https://en.wikiquote.org/w/api.php?action=parse&page=" + title + "&format=json" | |
request(url, function(error, responseCode, body) { |
NewerOlder