Skip to content

Instantly share code, notes, and snippets.

View avantgardnerio's full-sized avatar

Brent Gardner avantgardnerio

  • Coralogix
  • Denver, CO
View GitHub Profile
import com.thinkaurelius.titan.core.TitanFactory;
import com.thinkaurelius.titan.core.TitanGraph;
import com.thinkaurelius.titan.core.TitanVertex;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.util.io.graphml.GraphMLWriter;
import org.apache.commons.configuration.BaseConfiguration;
import org.apache.commons.configuration.Configuration;
import java.io.File;
import java.io.FileOutputStream;
@avantgardnerio
avantgardnerio / cheat.js
Last active November 9, 2015 10:31
JavaScript cheat sheet
// Fantastic guide: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types
// ------------------ literals ----------------------
var integer = 7;
var float = 7.7;
var str1 = "Hello world!";
var str2 = 'Hello world!';
var object = {};
var array = ["a", "b"];
bgardner@bgdell:~/projects/cget-cli/bin$ cat out.txt
Usage
cmake [options] <path-to-source>
cmake [options] <path-to-existing-build>
Specify a source directory to (re-)generate a build system for it in the
current working directory. Specify an existing build directory to
re-generate its build system.
Struct Header {
header_sz: i32,
item_type: i64, // Like an enum, says what data type comes after this header: ints, floats, etc
item_count: i32,
item_sz: i32
// After this header, I expect to see item_count items of item_type
}
unsafe {
let mut vec:Vec<u64> = Vec::with_capacity(size);
<html>
<head>
<script type="text/javascript">
"use strict";
var ar = ["a","b","c"];
for(var i = 0; i < ar.length; i++) {
var item = ar[i];
setTimeout(function() {
console.log(item);
import org.deeplearning4j.nn.api.{OptimizationAlgorithm}
import org.deeplearning4j.nn.conf.layers.RBM.{HiddenUnit, VisibleUnit}
import org.deeplearning4j.nn.conf.{GradientNormalization, Updater, MultiLayerConfiguration, NeuralNetConfiguration}
import org.deeplearning4j.nn.conf.distribution.UniformDistribution
import org.deeplearning4j.nn.conf.layers.{RBM, OutputLayer, RnnOutputLayer}
import org.deeplearning4j.nn.multilayer.MultiLayerNetwork
import org.deeplearning4j.nn.weights.WeightInit
import org.deeplearning4j.optimize.listeners.ScoreIterationListener
import org.nd4j.linalg.api.ndarray.INDArray
import org.nd4j.linalg.dataset.{SplitTestAndTrain, DataSet}
package com.squarelabs.spark;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.introspect.AnnotatedMember;
import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
import org.jooq.DSLContext;
import org.jooq.Record;
import org.jooq.Result;
import org.jooq.SQLDialect;
import org.jooq.impl.DSL;
@avantgardnerio
avantgardnerio / packer.scala
Created April 12, 2016 17:11
HTML packer in a few lines of scala
// TODO: Replace with an off-the-shelf Java HTML packer
val doc = Jsoup.parse(html)
doc.select("link") // Replace CSS
.filter(link => "stylesheet".equalsIgnoreCase(link.attr("rel")))
.filter(link => new URI(link.attr("href")).getHost == null)
.foreach(link => {
val el = new Element(Tag.valueOf("style"), "")
val css = getResourceAsString(new URI(link.attr("href")).getPath)
val m = cssUrlPattern.matcher(css)
val s = new StringBuffer()
<html>
<head>
<script type="text/javascript">
var url = 'https://galvanize-student-apis.herokuapp.com/gdating/members?limit=10';
var method = 'GET';
var xhr = new XMLHttpRequest();
xhr.open(method, url, true);
xhr.onload = function(data) {
console.log(data);
<html>
<head>
<script type="text/javascript">
var url = 'https://galvanize-student-apis.herokuapp.com/gdating/members?limit=10';
var method = 'GET';
var xhr = new XMLHttpRequest();
xhr.open(method, url, true);
xhr.onload = function(data) {
console.log(data.currentTarget.response);