Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View coin8086's full-sized avatar
🏠
Working from home

Robert Zhang coin8086

🏠
Working from home
  • @Azure Microsoft
  • Shanghai, China
View GitHub Profile
@coin8086
coin8086 / powershell-vs-bash.md
Last active April 15, 2024 09:49
PowerShell vs Bash

PowerShell vs Bash

Key different points

  • Bash commands output strings while PS commands output objects!

Examples

The following standard aliases in PowerShell are used:

@coin8086
coin8086 / using-proxy-for-git-or-github.md
Last active April 7, 2024 07:40
Use Proxy for Git/GitHub

Use Proxy for Git/GitHub

Generally, the Git proxy configuration depends on the Git Server Protocol you use. And there're two common protocols: SSH and HTTP/HTTPS. Both require a proxy setup already. In the following, I assume a SOCKS5 proxy set up on localhost:1080. But it can also be a HTTP proxy. I'll talk about how to set up a SOCKS5 proxy later.

SSH Protocol

When you do git clone ssh://[user@]server/project.git or git clone [user@]server:project.git, you're using the SSH protocol. You need to configurate your SSH client to use a proxy. Add the following to your SSH config file, say ~/.ssh/config:

ProxyCommand nc -x localhost:1080 %h %p
@coin8086
coin8086 / linux-linkers-and-loaders.md
Last active January 21, 2024 05:22
Linux Linkers and Loaders

Linux Linkers and Loaders

Tools

  • ldconfig
  • ld.so
  • ld
  • ldd

ldconfig

@coin8086
coin8086 / cgroup-and-systemd.md
Last active January 17, 2024 01:31
cgroup and systemd

cgroup and systemd

cgroup

"The control groups, abbreviated as cgroups in this guide, are a Linux kernel feature that allows you to allocate resources — such as CPU time, system memory, network bandwidth, or combinations of these resources — among hierarchically ordered groups of processes running on a system."

Check the cgroups by systemd-cgls.

Resource controller

@coin8086
coin8086 / wsl-settings-and-issues.md
Last active January 13, 2024 04:06
WSL settings and issue fixes

WSL Settings and Issue Fixes

Enable systemd

  1. Get the latest version WSL from the Windows Store

  2. Ensure /etc/wsl.conf has

[boot]

@coin8086
coin8086 / pytorch-ddp.md
Last active December 29, 2023 08:36
Distributed Model Training in PyTorch DDP

Distributed Model Training in PyTorch DDP

Prerequisites

Ensure GPU device is ready

Check GPU by lspci

Ensure enough free disk space

@coin8086
coin8086 / proxy.md
Last active July 1, 2023 04:43
Proxy

Proxy

Proxy vs VPN

  • Proxy is not VPN.
  • An application could provide an option to use a proxy, by a command line parameter, or an environment variable. Or it could provide no option for proxy at all!
  • VPN is an easy way to "proxy" the whole system without any application specific settings.

A proxy could use SOCKS or HTTP protocol.

@coin8086
coin8086 / gist:488580e650a552bdfbd0f858c193a26e
Last active March 8, 2023 10:13
Compile CppREST on CentOS 7

Compile C++ REST SDK on CentOS 7

C++ REST SDK is built on Ubuntu 16 by the offical document. To build it on CentOS 7, here's how.

Prerequisites:

  1. Install build tools by sudo yum group install Development\ Tools
  2. Install dependent libraries by sudo yum install zlib-devel libicu-devel openssl-devel
  3. Get CMake 3.x binary from https://cmake.org/download/
  4. Get Boost 1.58 source code from https://www.boost.org/users/history/ and install it under /opt/boost_1_58_0 by https://www.boost.org/doc/libs/1_58_0/more/getting_started/unix-variants.html#easy-build-and-install.
@coin8086
coin8086 / linux-dev-setup.md
Last active March 8, 2023 03:11
Service Fabric in brief

Setup Service Fabric Development Environment on Linux

The official document at https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-get-started-linux is problematic (ESPECIALLY, DO NOT follow the instruction in that document to install Docker!). Here're the correct steps.

Prerequisites

  1. Check if your Linux distro and version are supported at https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-versions#supported-linux-versions-and-support-end-date
  2. Setup Docker as instructed by https://docs.docker.com/engine/install/ubuntu

Install Service Fabric SDK

@coin8086
coin8086 / tls-in-a-nutshell.md
Last active November 24, 2022 06:36
TLS in a Nutshell

TLS in a Nutshell

TOC

  • What's TLS?
  • TLS Protocol
  • TLS Implementation

What's TLS?