Skip to content

Instantly share code, notes, and snippets.

View imjacobclark's full-sized avatar
:shipit:
Shipping

Jacob Clark imjacobclark

:shipit:
Shipping
View GitHub Profile
[jacobclark:~/Desktop/rust]$ make check-stage1-cfail TESTNAME=issue-25579 -j4 (ice-test-case-25579✱)
cfg: version 1.11.0-dev (81be48f3b 2016-06-08)
cfg: build triple x86_64-apple-darwin
cfg: host triples x86_64-apple-darwin
cfg: target triples x86_64-apple-darwin
cfg: host for x86_64-apple-darwin is x86_64
cfg: os for x86_64-apple-darwin is apple-darwin
cfg: have good valgrind for x86_64-apple-darwin
cfg: using CC=clang (CFG_CC)
cfg: using CXX=clang++ (CFG_CXX)
var ntc={init:function(){var color,rgb,hsl;for(var i=0;i<ntc.names.length;i++){color="#"+ntc.names[i][0];rgb=ntc.rgb(color);hsl=ntc.hsl(color);ntc.names[i].push(rgb[0],rgb[1],rgb[2],hsl[0],hsl[1],hsl[2]);}},name:function(color){color=color.toUpperCase();if(color.length<3||color.length>7)return["#000000","Invalid Color: "+color,false];if(color.length%3==0)color="#"+color;if(color.length==4)color="#"+color.substr(1,1)+color.substr(1,1)+color.substr(2,1)+color.substr(2,1)+color.substr(3,1)+color.substr(3,1);var rgb=ntc.rgb(color);var r=rgb[0],g=rgb[1],b=rgb[2];var hsl=ntc.hsl(color);var h=hsl[0],s=hsl[1],l=hsl[2];var ndf1=0;ndf2=0;ndf=0;var cl=-1,df=-1;for(var i=0;i<ntc.names.length;i++){if(color=="#"+ntc.names[i][0])return["#"+ntc.names[i][0],ntc.names[i][1],true];ndf1=Math.pow(r-ntc.names[i][2],2)+Math.pow(g-ntc.names[i][3],2)+Math.pow(b-ntc.names[i][4],2);ndf2=Math.pow(h-ntc.names[i][5],2)+Math.pow(s-ntc.names[i][6],2)+Math.pow(l-ntc.names[i][7],2);ndf=ndf1+ndf2*2;if(df<0||df>ndf){df=ndf;cl=i;}}return(cl<0?["
@imjacobclark
imjacobclark / MachineLearningApplication.java
Last active January 10, 2017 12:53
XOR Machine Learning Example (Encog, Java 8 + annotated)
package xyz.jacobclark;
import org.encog.engine.network.activation.ActivationSigmoid;
import org.encog.ml.data.MLData;
import org.encog.ml.data.MLDataPair;
import org.encog.ml.data.basic.BasicMLDataSet;
import org.encog.neural.networks.BasicNetwork;
import org.encog.neural.networks.layers.BasicLayer;
import org.encog.neural.networks.training.propagation.resilient.ResilientPropagation;
@imjacobclark
imjacobclark / README.md
Last active February 26, 2017 16:41
Association Lisps 💥

Association Lisps 💥

Running:

$ brew install sbcl
$ sbcl --script association.cl
@imjacobclark
imjacobclark / AND-single-layer-neurone.py
Last active April 23, 2017 14:40
A single layer neural network to determine AND boolean logic
def nn(input1, input2):
bias = 1
weight0 = -1
weight1 = 0.5
weight2 = 0.5
net = (bias*weight0)+(input1*weight1)+(input2*weight2)
return "1" if net >= 0 else "0"
@imjacobclark
imjacobclark / LinearRegression.java
Created January 4, 2018 23:03
Simple Linear Regression implementation in Java
package xyz.jacobclark;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import static java.util.Arrays.asList;
public class LinearRegression {
private static final List<Integer> x = asList(2, 3, 5, 7, 9, 11, 14); // Consecutive hours developer codes
module Main where
import Network.HTTP.Conduit
import qualified Data.ByteString.Lazy as L
import Text.Regex.PCRE
findNewsroundLinks :: String -> [String]
findNewsroundLinks = map read . getAllTextMatches . (=~ "href=\"/newsround([^\"#]+)")
bytestringToString :: L.ByteString -> [String]
@imjacobclark
imjacobclark / index.js
Created December 7, 2018 12:01
API Gateway -> Lambda -> Apollo -> AppSync -> GitHub API
const query = require('./query.js');
require('es6-promise').polyfill();
exports.handler = function(event, context, callback) {
query(event["queryStringParameters"]['username']).then(function(data){
var resp = {
"isBase64Encoded": false,
"statusCode": 200,
package xyz.jacobclark.day3;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
@imjacobclark
imjacobclark / lex.rs
Last active January 11, 2019 22:45
A Lexer in Rust
#[derive(Debug, PartialEq)]
enum Token {
Symbol(Symbol),
Type(Type),
Keyword(Keyword),
Word(Word),
Char(char),
}
#[derive(Debug, PartialEq)]