View gist:414842
ENTITY book_lines | |
{ | |
int book_line_id, | |
string line, | |
int source, | |
int linenum, | |
int created_at, | |
int updated_at | |
PRIMARY(linenum, source) | |
} |
View gist:611203
#include "algebra3.h" | |
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
static inline bool refract(const vec3& N, const vec3& I, const double n1, const double n2, vec3& result) { | |
double n = n1 / n2; | |
double cosI = -(N * I); | |
double sinT2 = n * n * ( 1.0 - cosI * cosI ); |
View gist:802493
diff --git a/src/jpdr/server/support/DatastoreEnvironment.java b/src/jpdr/server/support/DatastoreEnvironment.java | |
index 425fa30..7bb4ddb 100644 | |
--- a/src/jpdr/server/support/DatastoreEnvironment.java | |
+++ b/src/jpdr/server/support/DatastoreEnvironment.java | |
@@ -16,8 +16,9 @@ import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
-import java.nio.file.FileAlreadyExistsException; | |
-import java.nio.file.Path; |
View cpux86.js
/* | |
PC Emulator | |
Copyright (c) 2011 Fabrice Bellard | |
Redistribution or commercial use is prohibited without the author's | |
permission. | |
*/ | |
"use strict"; | |
var aa; |
View gist:1062386
val d = DateFormat.getDateInstance(DateFormat.SHORT).parse("11/20/1988") | |
val c = Calendar.getInstance | |
c.setTime(d) | |
c.add(Calendar.MONTH, 5) | |
val d1 = c.getTime() | |
d1.toString() | |
res8: java.lang.String = Thu Apr 20 00:00:00 PDT 1989 | |
View TestWS.java
import java.net.URI; | |
import java.net.URISyntaxException; | |
import org.java_websocket.WebSocketImpl; | |
import org.java_websocket.client.WebSocketClient; | |
import org.java_websocket.handshake.ServerHandshake; | |
public class TestWS { |
View standalone.py
import numpy as np | |
import itertools as it | |
def normalize(x): | |
return x / np.sum(x) | |
def normalizerow(x): | |
return (x.T / np.sum(x, axis=1)).T | |
def normalizecol(x): |
View gist:8074313
stephentu@peavey:~$ mkdir tester | |
stephentu@peavey:~$ cd tester | |
stephentu@peavey:~/tester$ git init | |
Initialized empty Git repository in /Users/stephentu/tester/.git/ | |
stephentu@peavey:~/tester(master)$ touch foo.c | |
stephentu@peavey:~/tester(master)$ git add foo.c | |
stephentu@peavey:~/tester(master)$ git commit -m 'first commit' | |
[master (root-commit) 3e51a35] first commit | |
0 files changed | |
create mode 100644 foo.c |
View gist:9405802
// computes and steps along the gradient of the SVM objective function: Sum_i HingeLoss(1.0 - normal^Tx_i y_i) + ||w||_2^2 | |
public static double[] SupportVectorStep(PINQueryable<Example> input, double[] normal, double epsilon) | |
{ | |
// select the examples that are currently mis-labeled by the normal vector. also add some negative normal for our regularizer | |
var errors = input.Where(x => x.label * x.vector.Select((v, i) => v * normal[i]).Sum() < 1.0) | |
.Concat(Enumerable.Repeat(new Example(normal, -1.0), 10).AsQueryable()); | |
// fold the average error into the normal | |
var newnormal = new double[normal.Length]; | |
foreach (var coordinate in Enumerable.Range(0, normal.Length)) |
View gist:9899592
stephentu@ben:/x/2/stephentu/dice/src/cpp(master)$ ./simulator opt.values | |
starting simulation of 10000 trials | |
mean=271.217, std=41.8306 |
OlderNewer