Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Sheng d4rkb1ue

🎯
Focusing
Block or report user

Report or block d4rkb1ue

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:4da19a6e3a543d894a48e08ae6b41633
  • What do Etcd, Consul, and Zookeeper do?
    • Service Registration:
      • Host, port number, and sometimes authentication credentials, protocols, versions numbers, and/or environment details.
    • Service Discovery:
      • Ability for client application to query the central registry to learn of service location.
    • Consistent and durable general-purpose K/V store across distributed system.
      • Some solutions support this better than others.
      • Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
      • Centralized locking can be based on this K/V store.
@d4rkb1ue
d4rkb1ue / albert_translate.py
Created Aug 21, 2018
albert translate 中文 <-> English
View albert_translate.py
# -*- coding: utf-8 -*-
"""Translate text using Google Translate.
Usage: tr <src lang> <dest lang> <text>
Example: tr en fr hello
Check available languages here: https://cloud.google.com/translate/docs/languages"""
import json
import urllib.parse
@d4rkb1ue
d4rkb1ue / SimpleHTTPRequestHandler_Specific_Dir_with_204.py
Created Jul 25, 2018
Python SimpleHTTPServer: Serve specific directory and send 204 instead of 404 when file not found
View SimpleHTTPRequestHandler_Specific_Dir_with_204.py
# #!/usr/bin/env python2
import posixpath
import argparse
import urllib
import os
from SimpleHTTPServer import SimpleHTTPRequestHandler
from BaseHTTPServer import HTTPServer
class RootedHTTPServer(HTTPServer):
@d4rkb1ue
d4rkb1ue / update_gfwlist.sh
Last active Oct 13, 2016 — forked from VincentSit/update_gfwlist.sh
Usage(On Mac) `sudo -H ./update_gfwlist.sh`
View update_gfwlist.sh
#!/bin/bash
# update_gfwlist.sh
# Author : VincentSit
# Copyright (c) http://xuexuefeng.com
# ---Modified by d4rkb1ue drkbl.com---
# Trouble shooting
# `sudo: ./update_gfwlist.sh: command not found`
# run `chmod +x update_gfwlist.sh`
You can’t perform that action at this time.