Skip to content

Instantly share code, notes, and snippets.

private IEnumerable<string> ConvertToMarkdownTables(string response)
{
var jobj = JObject.Parse(response);
var arrays = GetAllArrays(jobj);
var tabs = new List<string>();
foreach (var a in arrays)
{
var tab = DumpTable(a);
tabs.Add(tab);
@zinark
zinark / opt.py
Created March 20, 2018 10:23
convergence
import math
def sign (x):
if x > 0: return 1
if x < 0: return -1
return 0
def is_misclassified (x, w, b, y):
val = x[0]*w[0] + x[1]*w[1] + b
print ("x=", x, "w=", w, "b=", b, "y=", y, "mis_classification=", sign(y) != sign(val))
static class IO
{
public static int ReadInt ()
{
var n = Console.ReadLine ();
return int.Parse (n);
}
@zinark
zinark / Features
Last active August 29, 2015 14:20
Halo
Master Product Import
* Formats : CSV, XML, JSON
* Bind sources: Http, Ftp, Tcp
WHAT TO IMPORT : You can import master product datas from various file formats.
HOW TO IMPORT : Import Process supports different protocols.
TAGBOXES Tag your Products with TagBox.
* Color = Red
* Price = 5
[Test]
public void functional_lists()
{
FuncList<Func<int>> first = null;
FuncList<Func<int>> current = null;
Enumerable.Range(1,100).ToList().ForEach(x =>
{
var newFunc = new FuncList<Func<int>>(() => x, new FuncList<Func<int>>());
if (first == null)
{
List<string> _trace = new List<string>();
int SumNumbers(int from, int to)
{
_trace.Add(string.Format("SumNumbers ({0},{1}) : int {{", from, to));
if (from > to)
{
_trace.Add(string.Format("({0} > {1}) return 0 }}", from, to));
return 0;
@zinark
zinark / varnish scaling.txt
Created August 17, 2012 10:27
varnish scaling
director directorname dns {
.list = {
.host_header = "www.example.com";
.port = "80";
.connect_timeout = 0.4;
"192.168.15.0"/24;
"192.168.16.128"/25;
}
.ttl = 5m;
}
@zinark
zinark / recursion.py
Created July 7, 2012 12:37
recursion problem
def S(seq, i=0):
if i == len(seq): return 0
return S(seq, i + 1) + seq[i]
sys.setrecursionlimit(100000)
print S(range(100000), 0)
@zinark
zinark / RECURSIVITY.cs
Created July 7, 2012 12:34
Recursive Problem on stack
static void Main(string[] args)
{
Console.WriteLine(S(Enumerable.Range(1, 23456).ToList())); // No problem
Console.WriteLine(S(Enumerable.Range(1, 25799).ToList())); // Stack problem
}
static int S(IList<int> seq, int i = 0) // Problem function
{
if (i == seq.Count()) return 0;
# X = [1,1,1,1,1]
# Y = [1,1,1,1,1]
X = [2,3]
Y = [4,5]
def pearson (x,y):
print 'x ',x
print 'y ',y