Skip to content

Instantly share code, notes, and snippets.

View treo's full-sized avatar

Paul Dubs treo

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@treo
treo / build-dl4j-stack.sh
Last active June 7, 2017 22:36 — forked from crockpotveggies/build-dl4j-stack.sh
Script that cleanly builds and locally installs the Deeplearning4j stack
#!/bin/bash
# helper function that ensures cmd returns 0 exit code
function checkexit {
"$@"
local status=$?
if [ $status -ne 0 ]; then
echo "error with $1" >&2
exit 1
fi
@treo
treo / Readme.md
Created May 22, 2016 00:10
Building a current Intel OpenMP Runtime for Ubuntu

Current Ubuntu releases ship with a quite old version of the Intel OpenMP runtime. But getting a newer one is pretty simple:

  1. Enable Source Repositories for APT: Make sure you have the following in either a file in /etc/apt/sources.list.d or in your /etc/apt/souces.list

deb-src http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse

deb-src http://security.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://archive.canonical.com/ubuntu/ trusty partner

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ldt.plateregconition;
import java.io.DataInputStream;
import java.io.DataOutputStream;
@treo
treo / gist:faed20d9275276128cc8
Created May 17, 2015 19:47
Simple example how the gson streaming api might be used from clojure.
(import com.google.gson.stream.JsonReader)
(import com.google.gson.Gson)
(def data "[{\"id\":2,\"name\":\"Thing1\"},{\"id\":3,\"name\":\"Thing2\"},{\"id\":4,\"name\":\"Thing3\"}]")
(def gson (Gson.))
(defrecord example [id name])
(defn to-record [java-map]
(map->example (into {} (map
(juxt
@treo
treo / App.java
Last active July 18, 2019 18:31
Chance.js Java integration is quite easy
import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Random;
import java.util.function.Supplier;
public class App
@treo
treo / test.js
Created April 9, 2014 11:04
Accessing a SOAP web service which requires a client certificate using node-soap 0.4.3
var soap = require('soap'),
fs = require('fs');
client = soap.createClient('https://some-webserv.ic/something.wsdl', {
wsdl_options: {
cert: fs.readFileSync('cert.pem'),
key: fs.readFileSync('keyfile.key')
}
}, function(err, client){
console.log(client.describe());
@treo
treo / codegen.py
Created September 29, 2011 11:26 — forked from mattbasta/codegen.py
A module to "unparse" a Python AST tree.
# -*- coding: utf-8 -*-
"""
codegen
~~~~~~~
Extension to ast that allow ast -> python code generation.
:copyright: Copyright 2008 by Armin Ronacher.
:license: BSD.
"""
# -*- coding: utf-8 -*-
from functools import wraps
import time
def retry(tries, exceptions=None, delay=0):
"""
Decorator for retrying a function if exception occurs
tries -- num tries
exceptions -- exceptions to catch