Skip to content

Instantly share code, notes, and snippets.

View jiahut's full-sized avatar
🎯
Focusing

zhijia,.zhang jiahut

🎯
Focusing
View GitHub Profile
@jiahut
jiahut / install.md
Last active September 2, 2018 15:27
typescript runtime at centos7
@jiahut
jiahut / zerorpc.md
Last active November 21, 2018 03:01 — forked from ninehills/zerorpc.md
ZeroRPC简介 - 轻量级分布式通信框架

ZeroRPC简介 - 轻量级分布式通信框架

概述

分布式系统的核心是分布式通信,而传统上开发一套支持上千台规模集群,可靠性非常高的分布式通信框架,需要不少的精力投入。而在多数情景下,我们(特别是时间宝贵的OP)并不是非常关注技术实现的细节,而是希望有一套成熟、轻量、可靠性高、使用方便而且易于调试的分布式通信框架,可以直接使用,从而把时间放在具体业务逻辑上。

在PyCon 2012大会上,dotcloud公司开源了一套基于ZeroMQ和MessagePack的分布式通信框架(或者说是协议+Python实现)。该框架因为基于ZeroMQ,使用方法是RPC,所以被命名为ZeroRPC。ZeroRPC的特点在其官网的介绍中一目了然[1]:

ZeroRPC is a light-weight, reliable and language-agnostic library for distributed communication between server-side processes.

@jiahut
jiahut / extract.md
Last active November 7, 2018 07:07
extract audio from youtube

brew install youtube-dl ffmpeg

youtube-dl -x --audio-format mp3 --proxy socks5://127.0.0.1:1086 <yotube_url>

@jiahut
jiahut / xmltool.py
Last active November 7, 2018 09:24
#/usr/bin/env python
import re
import sys
from xml.dom.minidom import parseString
_xml_re = re.compile('>\n\s+([^<>\s].*?)\n\s+</', re.DOTALL)
def pretty_xml_old(xml_str, indent=" "):
xml_re = _xml_re
# avoid re-prettifying large amounts of xml that is fine
;; You need to install https://github.com/vovkasm/input-source-switcher
;; In thу Terminal # issw show you namу of the current layout
;; (setq issw_default_lang_source "com.sogou.inputmethod.sogou.pinyin")
(setq issw_default_lang_source "com.apple.keylayout.US")
(defun my/enter-evil-state-hook()
(interactive)
(shell-command (concat "issw " issw_default_lang_source)))
(defun my/exit-evil-state-hook()
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]
"DisableLockWorkstation"=dword:00000001
@jiahut
jiahut / win.ahk
Last active February 22, 2019 14:54
win shotcut behavior like mac
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; +CapsLock::CapsLock
; CapsLock::Ctrl
; #::Ctrl
\::BackSpace
BackSpace::\
`::Escape
@jiahut
jiahut / README.md
Last active May 9, 2019 07:05
win & mac vscode settings & keybindings

backup vscode extensions

code --list-extensions >! mac-vscode-list-extensions.log

useful key

| key | note | | Mac + j | toggle panel |

@jiahut
jiahut / docker-compose.yml
Created February 14, 2019 01:05 — forked from heipei/docker-compose.yml
Docker Compose for nsqd, nsqlookupd and nsqadmin, all linked
nsqlookupd:
image: nsqio/nsq
ports:
- "4160:4160"
- "4161:4161"
command: /nsqlookupd
nsqd:
image: nsqio/nsq
ports: