Skip to content

Instantly share code, notes, and snippets.

@rstonkus
rstonkus / consul.lua
Created January 10, 2018 19:49 — forked from gmr/consul.lua
Dynamic Nginx upstream nodes using Consul
module("resty.consul", package.seeall)
_VERSION = '0.1.0'
function service_nodes(service)
local http = require "resty.http"
local json = require "cjson"
local hc = http:new()
local upstream = ""
@rstonkus
rstonkus / kmeans.py
Created February 28, 2017 23:51 — forked from dave-andersen/kmeans.py
k-means in Tensorflow
import tensorflow as tf
import numpy as np
import time
N=10000
K=4
MAX_ITERS = 1000
start = time.time()
@rstonkus
rstonkus / diet_stress_test.py
Created January 6, 2017 21:52
Stress test script for the 'Optimal Diet Problem' from Week 2 of Advanced Algorithms and Complexity: https://www.coursera.org/learn/advanced-algorithms-and-complexity
from __future__ import print_function
import numpy as np
from scipy.optimize import linprog
import subprocess
for _ in range(100000):
n, m = np.random.randint(1, 8, size = (2,))
A = np.random.randint(-100, 100, size = (n, m,))
b = np.random.randint(-1000000, 1000000, size = (n,))
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;