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 / 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?

@coin8086
coin8086 / ubuntu-vs-centos.md
Last active December 17, 2021 03:40
Ubuntu VS CentOS

Ubuntu VS CentOS

Package Management

Ubuntu CentOS
Search package that contains the file dpkg -S <file> rpm -qf <file>
List package files dpkg -L <package> rpm -ql <package>
Search packages with glob pattern dpkg -l <pattern> rpm -qa <pattern>
Show package info dpkg -s <package> / dpkg -p <package> rpm -qi <package>
@coin8086
coin8086 / git-on-windows-eol-and-mode.md
Created March 1, 2019 03:23
Git on Windows: File EOL and Permission Mode

Git on Windows: File EOL and Permission Mode

@coin8086
coin8086 / docker-cmd-completion.md
Last active March 1, 2019 03:25
Docker command line completion in Bash

Docker Command Line Completion in Bash

Prerequisites

  1. Make sure bash completion is installed(It's installed by default in major Linux distributions, and Cygwin).
  2. Put completion files to /etc/bash_completion.d/

Completion Files

@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 / 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 / getting_start_on_rest.md
Last active April 20, 2018 06:57
Getting Start on REST​

Getting Start on REST

A Simple Definition

REST is a style and a set of guide lines for web service, such as web API.

It

  • is resource oriented
  • uses HTTP method to convey method information
  • uses URL to scope the resource to operate on
@coin8086
coin8086 / nas_server.md
Last active April 8, 2018 02:11
Raspberry Pi

Raspberry Pi NAS Server Getting Start

Install Raspbian OS

Get the OS image file(RASPBIAN STRETCH LITE) from https://www.raspberrypi.org/downloads/raspbian/, and write it into a SD card as said by https://www.raspberrypi.org/documentation/installation/installing-images/README.md

Config for Remote Access

@coin8086
coin8086 / git_notes.md
Last active October 31, 2019 03:25
Git Notes

Git Notes

EOL

  1. Windows Git client sets core.ignorecase to true by default, you may need to disable it to detect server changes on file names. Check it by git config --get core.ignorecase, and set it by git config core.ignorecase false.
  2. Detect file EOL by git grep -I '^M'. It searches for a literal CR character in files.

Diff

  1. To git show more lines before and after the changed lines, use git show -U <NUM>.
  2. To git diff a file/dir between two commits, use git diff [--] . Either commit can be omitted, in which case it's as if HEAD is used for that omitted commit.
@coin8086
coin8086 / _document.md
Last active December 27, 2018 08:57
Bulk insert/upsert method for ActiveRecord on PostgreSQL(9.5 and later)

ActiveRecord Bulk Write Patch

Usage

Suppose there's a table

create table users (
  id integer primary key,
  name text,