Skip to content

Instantly share code, notes, and snippets.

James Sutton zeryx

Block or report user

Report or block zeryx

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
View gist:88ee0cb5d158a43db5e6abc20368b68d
import torch as th
from torchvision import models, transforms
from PIL import Image
import numpy as np
model = models.resnet18(pretrained=True)
class Identity(th.nn.Module):
def __init__(self):
super(Identity, self).__init__()
View 00check.log
$ cat algorithmia-r.Rcheck/00check.log
* using log directory ‘/home/zeryx/code/work/algorithmia-r.Rcheck’
* using R version 3.4.4 (2018-03-15)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* using option ‘--as-cran’
* checking for file ‘algorithmia-r/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘algorithmia’ version ‘0.2.0’
* package encoding: UTF-8
View build.sbt
name := "algorithm-handler"
organization := "com.foo"
version := "1.0.0"
autoScalaLibrary := false
View algorithmia-build.sh
set -e
CRAN_MIRROR=${CRAN_MIRROR:=http://cran.rstudio.com/}
# When installing from CRAN, use this mirror as a default
echo "options(repos=structure(c(CRAN=\"$CRAN_MIRROR\")))" > ~/.Rprofile
ROOTDIR=/opt/algorithm
# First install the latest CRAN packages system wide so it can populate the shared cache
View input.json
{
"data":[
{
"text":"The atomic nucleus is held together with the strong nuclear force. Nuclear power is a very economical fuel source for today's economies."
}
],
"namespace":"data://nlp/arxiv_model",
"mode":"predict",
"option":"very accurate",
"returnDocs":true
View AdvancedAlgorithm.java
package AlgorithmHandler.algorithms;
import java.util.HashMap;
public class AdvancedAlgorithm {
public class AlgoInput {
String name;
Integer age;
View pipeCreation.java
@Before
public void IntializePipe() throws IOException, InterruptedException {
Process p = Runtime.getRuntime().exec("mkfifo /tmp/pipe");
p.waitFor();
Thread.sleep(100);
System.out.println("fifo pipe made.");
}
View synthpop errors
Loading required package: methods
Installing package into ‘/opt/algorithm/dependencies’
(as ‘lib’ is unspecified)
Warning: dependency ‘mvtnorm’ is not available
also installing the dependencies ‘glue’, ‘stringi’, ‘colorspace’, ‘utf8’, ‘TH.data’, ‘stringr’, ‘labeling’, ‘munsell’, ‘RColorBrewer’, ‘fansi’, ‘pillar’, ‘pkgconfig’, ‘libcoin’, ‘matrixStats’, ‘multcomp’, ‘truncnorm’, ‘gtable’, ‘lazyeval’, ‘reshape2’, ‘scales’, ‘tibble’, ‘viridisLite’, ‘withr’, ‘modeltools’, ‘strucchange’, ‘coin’, ‘zoo’, ‘sandwich’, ‘e1071’, ‘cmm’, ‘Rsolnp’, ‘numDeriv’, ‘ggplot2’, ‘party’, ‘plyr’, ‘proto’, ‘polspline’, ‘randomForest’, ‘classInt’, ‘mipfp’
trying URL 'http://cran.rstudio.com/src/contrib/glue_1.3.1.tar.gz'
Content type 'application/x-gzip' length 122950 bytes (120 KB)
==================================================
downloaded 120 KB
trying URL 'http://cran.rstudio.com/src/contrib/stringi_1.4.3.tar.gz'
View AlgorithmBasic.java
package com.org.example;
import java.util.HashMap;
/**
* Hello world!
*
*/
class AlgorithmBasic
{
View AlgoHandler.java
public class AlgorithmHandler<INPUT, O, CONTEXT> {
private BiFunction<INPUT, CONTEXT, O> applyFunc;
private Supplier<CONTEXT> loadFunc;
private HashMap<String, Object> context;
private <T, J, L> BiFunction<T, J, L> applyHandler(FunctionWithException<T, J, L> fe) {
return (arg1, arg2) -> {
try {
return fe.apply(arg1, arg2);
You can’t perform that action at this time.