Skip to content

Instantly share code, notes, and snippets.

LearnCode learncodeacademy

Block or report user

Report or block learncodeacademy

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
@learncodeacademy
learncodeacademy / iris-tensorflow-js.js
Last active Sep 23, 2019
Solving Iris with Tensorflow.js and Iris JSON dataset
View iris-tensorflow-js.js
import * as tf from "@tensorflow/tfjs"
import "@tensorflow/tfjs-node"
import iris from "./iris.json"
import irisTesting from "./iris-testing.json"
// convert/setup our data
const trainingData = tf.tensor2d(iris.map(item => [
item.sepal_length, item.sepal_width, item.petal_length, item.petal_width,
]))
const outputData = tf.tensor2d(iris.map(item => [
@learncodeacademy
learncodeacademy / gist:8acf7e3a2c4c33100f04c6715c662a01
Created Jun 11, 2018
Training a Neural Network - Enhanced Console Output From Brain.js
View gist:8acf7e3a2c4c33100f04c6715c662a01
Start Training!...Here's the data, we'll do 2 iterations:
[ { input: [ 0, 1 ], output: [ 1, 0 ] },
{ input: [ 1, 1 ], output: [ 1, 1 ] } ]
======== TRAINING ITERATION 1 =========
--------- Run input set 0: 0,1 ----------
-> Layer 2 has 3 nodes
START NODE: 0
-> bias for node 0: 0.13861538469791412
-> weights for node 0:
-> input value: 0, weight: -0.03485306352376938
@learncodeacademy
learncodeacademy / .drone.yml
Created Jun 28, 2017
Rancher Drone CD Pipeline Setup
View .drone.yml
pipeline:
slack:
image: plugins/slack
webhook: <your slack webhook url>
channel: deployments
username: drone
template: "<{{build.link}}|Deployment #{{build.number}} started> on <http://github.com/{{repo.owner}}/{{repo.name}}/tree/{{build.branch}}|{{repo.name}}:{{build.branch}}> by {{build.author}}"
when:
branch: [ master, staging ]
build:
@learncodeacademy
learncodeacademy / pickRandomComment.js
Created May 24, 2017
YouTube Random Comment Selector
View pickRandomComment.js
const axios = require("axios");
const key = "AIzaSyB9e-dHIvdxxrbmorjYHWipwBKq7LJBhNk"
function getComments(pageToken, allItems = {}) {
const params = {
key,
videoId: "a4haLJdDRmc",
part: "snippet",
maxResults: 100,
pageToken,
@learncodeacademy
learncodeacademy / keymap.c
Created Oct 10, 2016
Ergodox EZ Keymap - layer 2: mouse - layer3: arrows
View keymap.c
#include "ergodox_ez.h"
#include "debug.h"
#include "action_layer.h"
#define BASE 0 // default layer
#define MDIA 1 // mouse/media keys
#define ARROW 2 // arrow keys
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer
View webpack.config.js
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
@learncodeacademy
learncodeacademy / README.md
Last active Jun 24, 2017
Running a High Availability Service on CoreOS using Docker, Fleet, Flannel, Etcd, Confd & Nginx
View README.md

Running a High Availability Service on CoreOS using Docker, Fleet, Flannel, Etcd, Confd & Nginx

Tools used:

  • coreos: server machine clustering via a shared cloud-config.yml
  • etcd: key value store for service registration and discovery
  • fleet: scheduling/failover of docker containers across coreos cluster
  • flannel: Gives each docker container a unique ip that allows you to access the internal port (i.e. port 80 not 32679)
  • confd: watch etcd for nodes arriving/leaving - template nginx configuration files / reload nginx on change
@learncodeacademy
learncodeacademy / pubsub.js
Created Jul 29, 2015
Basic Javascript PubSub Pattern
View pubsub.js
//events - a super-basic Javascript (publish subscribe) pattern
var events = {
events: {},
on: function (eventName, fn) {
this.events[eventName] = this.events[eventName] || [];
this.events[eventName].push(fn);
},
off: function(eventName, fn) {
if (this.events[eventName]) {
View Dockerfile
FROM node:0.12.0
# use changes to package.json to force Docker not to use the cache
# when we change our application's nodejs dependencies:
ADD package.json /tmp/package.json
RUN cd /tmp && mkdir data && npm install --production --unsafe-perm
RUN mkdir -p /app && cp -a /tmp/node_modules /app/ && cp -a /tmp/data /app/
# From here we load our application's code in, therefore the previous docker
# "layer" thats been cached will be used if possible
@learncodeacademy
learncodeacademy / flightplan-html.md
Last active May 6, 2019
Deploy HTML site with Flightplan
View flightplan-html.md

###Prerequesites

Install flightplan globally

npm install -g flightplan

Install flightplan in your project folder

You can’t perform that action at this time.