Skip to content

Instantly share code, notes, and snippets.

@rabipelais
rabipelais / Dockerfile.deploy
Created June 25, 2019 08:53
The docker config files. I don't really think this will be helpful, but I do hope it is. I can't find the related ebextension files, but I do seem to recall it all boiled down to basically changing the docker run command to include the port parameter.
FROM fpco/stack-run:latest
RUN mkdir -p /bin
WORKDIR /bin
RUN apt-get update
RUN apt-get install -y libpq-dev
RUN ln -sf /proc/1/fd/1 /var/log/webserver.log
@rabipelais
rabipelais / README.md
Created October 18, 2018 21:19
Sebastian Mendez answer to Fineway's coding task.

Sebastian Mendez' solution to the Fineway short challenge

To execute, simply run python challenge.py. It should output a word and its occurrence count per line to stdout. Make sure the data file is in the same folder and it's called data.txt. (Tested on Ubuntu 18.04 with Python 3.6.6 and 2.7)

If by what I would do next to put in into production is meant how I could make it more robust, then:

  • Parametrize the data file, for example by passing it as an argument or connect it to some sort of document storage.
  • Use a much more robust way of tokenizing the input. For example using the NLKT (Natural Language Toolkit) library.
  • Also use a better way of counting the words. Numpy has some nice histogram functions.
@rabipelais
rabipelais / constraints.cpp
Created December 7, 2016 02:30
This are the equality constraints in the format required by NLOpt. It is basically multiplying out the matrices and taking the squared sum norm (Frobenius norm). I cannot figure out how to encode the sum of multiplications in the `hpijkr` format you provided, any help would be appreciated (I hope this code makes sense)..
//Identity constraint: `p . q = id`, where `p` and `q` are opposite projections on the same edge.
double identity_constraint(unsigned n, const double *x, double *, void *data)
{
surface_data* d = (surface_data*) data;
auto surface = d->surface;
auto neighbors = d->neighbors;
double error = 0;
visit_edges(*neighbors, [&](hpuint p, hpuint i) {
//`q` is CW!! in this case