Skip to content

Instantly share code, notes, and snippets.

View bwangelme's full-sized avatar
🚀
把 Star 当做收藏在用,点起来很随性。GitHub 全是各种 Tutorial 和 Demo

bwangel bwangelme

🚀
把 Star 当做收藏在用,点起来很随性。GitHub 全是各种 Tutorial 和 Demo
View GitHub Profile
import qrcode
from qrcode.util import *
def hack_put(self, num, length):
if num == 0:
num = 233 # make a fake length
for i in range(length):
self.put_bit(((num >> (length - i - 1)) & 1) == 1)
qrcode.util.BitBuffer.put = hack_put
[V=browser-hello.mp4] Hi, I'm Matthew from OpenResty Inc. In this video, I'll demonstrate how to implement a "hello world" HTTP interface using OpenResty.
First of all, we make sure we are using OpenResty's nginx.
[delay=0] $ export PATH=/usr/local/openresty/nginx/sbin:$PATH
$ which nginx
[S] It's usually in this path.
And then we go to the home directory.

深入Go并发编程研讨课

Go提供了我们便利的进行并发编程的工具、方法和同步原语,同时也提供给我们诸多的犯错的机会,也就是俗称的“坑”。即使是顶级Go开发的项目,比如Docker、Kubernetes、gRPC、etcd, 都是有经验丰富的Go开发专家锁开发,也踩过不少的并发的坑,而且依然源源不断的继续踩着,即便是标准库也是这样。

分析和总结并发编程中的陷阱,避免重复踩在别人的坑中,正式本次培训课的重要内容。只有深入了解并发原语的实现,全面了解它们的特性和限制场景,注意它们的局限和容易踩的坑,才能提高我们的并发编程的能力。通过了解和学习其他人的经验和贡献的项目和库,我们可以更好的扩展我们的视野,避免重复的造轮子,或者说我们可以制作更好的轮子。

语言的内存模型定义了对变量的读写的可见性,可以清晰而准确读写事件的happen before关系。对于我们,可以很好地分析和编排goroutine的运行,避免数据的竞争和不一致的问题。

通过本次课程,你可以:

@wilspi
wilspi / udp_server.py
Created February 12, 2019 14:08
Mock Statsd server
# -*- coding: utf-8 -*-
# Script to run UDP Server on 127.0.0.1:8126
# This mocks statsd server for testing
import socket
UDP_IP_ADDRESS = "127.0.0.1"
UDP_PORT_NO = 8126
@Tamal
Tamal / git-ssh-error-fix.sh
Last active November 14, 2024 11:16
Solution for 'ssh: connect to host github.com port 22: Connection timed out' error
$ git clone [email protected]:xxxxx/xxxx.git my-awesome-proj
Cloning into 'my-awesome-proj'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
$ # This should also timeout
$ ssh -T [email protected]
ssh: connect to host github.com port 22: Connection timed out
$ # but this might work
@berkedel
berkedel / flow-error-icu4c-not-loaded.md
Created April 4, 2018 14:13
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib

How to solve dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib

brew uninstall --ignore-dependencies node icu4c
brew install node
#!/bin/bash
#
# Author: bwangel<[email protected]>
# Date:Oct,10,2017 14:16
LOG_FILE="./2017_10_10uwsgi-webapp.log"
echo "" | awk '
END {
FMT = "%-33s\t%-5s\t%-15s%-10s\n"
@ryboe
ryboe / .travis.yml
Last active September 16, 2024 07:47
Example .travis.yml for Golang
# use the latest ubuntu environment (18.04) available on travis
dist: bionic
language: go
# You don't need to test on very old versions of the Go compiler. It's the user's
# responsibility to keep their compiler up to date.
go:
- 1.16.x
@bwangelme
bwangelme / colors.sh
Created February 10, 2017 09:05
bash 色表
#!/bin/bash
#
# Author: bwangel<[email protected]>
# Date: Feb,10,2017 16:55
for C in {0..255}; do
tput setaf $((255-${C}))
tput setab $C
echo -n "$C "
done
@bwangelme
bwangelme / metaclass.py
Created January 5, 2017 13:07
Metaclass 黑魔法
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
这个C元类的功能就是在准备类的命名空间的时候,
将其父类的非私有成员(不以_开头的成员)添加到
这个命名空间中,然后在创建这个类的时候,再把父类的非私有成员给删除掉。
"""
import os