Skip to content

Instantly share code, notes, and snippets.

Avatar
🍀
养得英风豪气在!

Robert Zhang coin8086

🍀
养得英风豪气在!
  • @Azure Microsoft
  • Shanghai, China
View GitHub Profile
@coin8086
coin8086 / tls-in-a-nutshell.md
Last active Apr 19, 2021
TLS in a Nutshell
View tls-in-a-nutshell.md

TLS in a Nutshell

TOC

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

What's TLS?

View ubuntu-vs-centos.md

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 Mar 1, 2019
Git on Windows: File EOL and Permission Mode
View git-on-windows-eol-and-mode.md

Git on Windows: File EOL and Permission Mode

@coin8086
coin8086 / docker-cmd-completion.md
Last active Mar 1, 2019
Docker command line completion in Bash
View docker-cmd-completion.md

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

View using-proxy-for-git-or-github.md

Use Proxy for Git/GitHub

Generally, the Git proxy configuration depends on the Git Server Protocal you use. And there're two common protocals: 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 protocal. 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
View gist:488580e650a552bdfbd0f858c193a26e

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 Apr 20, 2018
Getting Start on REST​
View getting_start_on_rest.md

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
View nas_server.md

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

View git_notes.md

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 <first-commit> <second-commit> [--] <filepath>. 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 Dec 27, 2018
Bulk insert/upsert method for ActiveRecord on PostgreSQL(9.5 and later)
View _document.md

ActiveRecord Bulk Write Patch

Usage

Suppose there's a table

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