Skip to content

Instantly share code, notes, and snippets.

import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt # used to show a graph of the data
# random data to find a formula from
trainX = np.asarray(np.linspace(0, 2, 30))
trainY = 2 * trainX + np.random.randn(trainX.shape[0]) * 0.33
# used in operations later
var options = {
url: 'https://oauth.reddit.com/api/v1/me', // the endpoint to hit
headers: {
'Authorization': 'bearer <YOUR ACCESS TOKEN>',
'User-Agent': '<YOUR USER AGENT HERE>'
}
}
request(options, (error, response, body) => {
if (error) {
var buffer = new Buffer(app_client_id + ':' + app_client_secret).toString('base64')
var auth = 'Basic ' + buffer
var options = {
url: 'https://www.reddit.com/api/v1/access_token',
form: {
"grant_type": "password",
"username": reddit_username,
"password": reddit_password
},