Skip to content

Instantly share code, notes, and snippets.

using System;
using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Factorization;
namespace PolyRegressionCoefficients
{
class Program
{
public static void DrawRegression(double[] coeffs, double[] xList)
@zhangz
zhangz / on-tail-recursion.md
Created July 14, 2018 12:10 — forked from mrange/on-tail-recursion.md
On the topic of tail calls in .NET

On the topic of tail calls in .NET

Let's say you have implemented a small data pipeline library to replace LINQ.

module TrivialStream =
  type Receiver<'T> = 'T            -> unit
  type Stream<'T>   = Receiver<'T>  -> unit

  module Details =
@zhangz
zhangz / ArrayPool.cs
Created June 4, 2017 05:58 — forked from christiannagel/ArrayPool.cs
Show memory address of array
unsafe private static void ShowAddress(string name, int[] item)
{
fixed (int* addr = item)
{
Console.Write($"\t0x{(ulong)addr:X}");
}
}
@zhangz
zhangz / python-stack.md
Last active April 22, 2017 14:03
Python Tech Stack
# coding: utf8
import tushare as ts
import pandas as pd
def calcOneMinuteBar():
# data_frame = pd.read_csv('AUDJPY-2016-01.csv', names=['Symbol', 'Date_Time', 'Bid', 'Ask'],
# index_col=1, parse_dates=True)
df = ts.get_tick_data('002743', date='2016-10-28')
# df.tail(10)
@zhangz
zhangz / bobp-python.md
Created April 4, 2017 01:16 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@zhangz
zhangz / recover_source_code.md
Created April 2, 2017 13:21 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@zhangz
zhangz / svn_to_git.rst
Created January 31, 2017 13:07 — forked from epicserve/svn_to_git.rst
Convert SVN Repositories to Git Repositories

Convert SVN Repositories to Git Repositories

This guide on how to convert an SVN repository to a git repository was mostly taken from John Albin Wilkins post on Converting a Subversion repository to Git.

1. Retrieve a list of all Subversion committers

:

@zhangz
zhangz / service-checklist.md
Created September 13, 2016 10:53 — forked from acolyer/service-checklist.md
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@zhangz
zhangz / AppDomainListning.cs
Created August 24, 2016 05:59 — forked from lowleveldesign/AppDomainListning.cs
Code which enumerates appdomains in a remote process using ETW
using Microsoft.Diagnostics.Tracing;
using Microsoft.Diagnostics.Tracing.Session;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
namespace ClrDacManaged
{
class Program