Skip to content

Instantly share code, notes, and snippets.

View li-ch's full-sized avatar
:shipit:
Focusing

Li Chen 陈 力 li-ch

:shipit:
Focusing
View GitHub Profile
from functools import reduce
def psum(G, P):
if len(P) > 1:
elist = list(zip(P,P[1:]))
return reduce(lambda x, y: x+y, [G.edges[e]['length'] for e in elist])
return 0
def exactpath(G,S,D,T,eps,sp_memo,curpath=[], pc=[], lc=[]):
if T < 0:
@li-ch
li-ch / curl.md
Created September 26, 2019 09:11 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

import numpy as np
SimTime = 10000
NumServer = 16
class Server(object):
def __init__(self, depth, rate):
self.max_depth = depth
self.rate = rate
self.cur_depth = depth
@li-ch
li-ch / CleanArchitecture.md
Created October 15, 2018 02:28 — forked from ygrenzinger/CleanArchitecture.md
Summary of Clean Architecture by Robert C. Martin

Summary of book "Clean Architecture" by Robert C. Martin

Uncle Bob, the well known author of Clean Code, is coming back to us with a new book called Clean Architecture which wants to take a larger view on how to create software.

Even if Clean Code is one of the major book around OOP and code design (mainly by presenting the SOLID principles), I was not totally impressed by the book.

Clean Architecture leaves me with the same feeling, even if it's pushing the development world to do better, has some good stories and present robust principles to build software.

The book is build around 34 chapters organised in chapters.

"""
installation:
git clone git@github.com:heikoheiko/pydevp2p.git
git co sha3id
python setup.py develop
pip install statistics networkx matplotlib
usage:
cd devp2p/tests/

Configuring Mellanox Switches

  1. Login to management console using admin:admin
  2. enable
  3. configure terminal
  4. vlan ### ### is the VLAN id, we use 198 and 199.
  5. Then the terminal will enter VLAN configuration mode, we set name to vlan### with name ###
  6. exit VLAN configuration mode
  7. Configure connect ports. For switch with VLAN 199, ethernet ports 1/1, 1/3, 1/5, 1/7 are connected to each server's eth2. For switch with VLAN 198 ethernet ports 1/10, 1/12, 1/14, 1/16 are connected to each server's eth3.

For each connected port, do the following:

#!/bin/sh
dir=./log/1
> $dir/CPU0
> $dir/Mem0
> $dir/Net0
> $dir/Dsk0
> $dir/Nfs0
@li-ch
li-ch / install_apt2.md
Last active March 23, 2018 12:26 — forked from SMANKULOV/install_apt2.md
Installing Caffe+NVIDIA CUDA Tools on Ubuntu 16.04 LTS

Installation Caffe + NVIDIA CUDA 7 Tools on Ubuntu 14.04 (step by step, including external libraries)

Guide for Ubuntu 16.04 with a 64 bit processor.

Tested on a Dell XPS L421x laptop with a NVIDIA GeForce GT 630m.

This guide is intended to be a (sort of) comprehensive step by step tutorial, including the installation of external dependencies.

This tutorial assumes some decisions about the versions and programs to install, to make it as straightforward to follow as possible, while still having as much advanced features as possible.

Notably:

It uses Anaconda Python (which facilitates installation and has many great feat

#nVidia drivers

sudo apt-add-repository ppa:xorg-edgers/ppa
sudo apt-get update
sudo apt-get install nvidia-current nvidia-settings

#Numix

sudo add-apt-repository ppa:numix/ppa