Skip to content

Instantly share code, notes, and snippets.

View bloatfan's full-sized avatar
🤒
Out sick

bloatfan bloatfan

🤒
Out sick
View GitHub Profile
@Integralist
Integralist / README.md
Last active February 21, 2026 11:17
Go: timeouts and custom http client #go #http #dns

Server Timeouts
Go Server Timeouts

Tip

Use context.WithTimeout when you need to enforce timeouts on internal operations like database queries or HTTP calls, especially when you want to propagate cancellation signals through the call stack to prevent resource leaks or manage goroutines. It's ideal for fine-grained control within a handler. In contrast, use http.TimeoutHandler when you want a simple way to enforce a timeout on the entire HTTP handler response, particularly when you don’t control the handler logic or don’t need to cancel ongoing work—it only cuts off the response after the timeout but doesn’t stop the underlying processing.

Warning

Be careful when using http.TimeoutHander. If automatically applied to all handlers (as part of a middleware pipeline) then it will not work when it comes to a streaming endpoint (see the relevant Cloudflare article linked in the NOTE below).

**Client Ti

@tavinus
tavinus / puppeteerDebianHeadless.md
Created September 11, 2020 09:14
Minimal Puppeteer NodeJS Debian 10 Buster

System

Debian 10 Buster headless

Chromium dependencies

Shared Libraries needed

$ sudo apt install libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libgbm1 libasound2 libpangocairo-1.0-0 libxss1 libgtk-3-0

Install nvm

Local user

@martianyi
martianyi / README.md
Last active February 16, 2022 13:18
Reverse proxy aws elasticsearch service using nginx
  1. 在elasticsearch域的同一vpc下开一台ec2机器,安装nginx
  2. 准备ssl证书
  3. 配置nginx如下
server {
    listen 443 ssl http2;
    server_name $host;
    rewrite ^/$ https://$host/_plugin/kibana redirect;

    ssl_certificate /path/to/fullchain.pem;
@redbearder
redbearder / CMakeLists.txt
Created April 18, 2020 12:57
Redis 5 debug with Clion in MacOS
# import src as CMake project with Clion
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(redis VERSION 5.0)
set(CMAKE_BUILD_TYPE "Debug")
get_filename_component(REDIS_ROOT "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)
add_subdirectory(deps)
add_subdirectory(src/modules)
#!/bin/bash
# data: 2020-03-31
# author: muzi502
# for: Fuck GFW and download some raw file form github without proxy using jsDelivr CDN
# usage: save the .she to your local such as /usr/bin/rawg, and chmod +x /usr/bin/rawg
# use rawg https://github.com/ohmyzsh/ohmyzsh/blob/master/tools/install.sh to download
set -xue
# GitHub rul: https://github.com/ohmyzsh/ohmyzsh/blob/master/tools/install.sh
# jsDelivr url: https://cdn.jsdelivr.net/gh/ohmyzsh/ohmyzsh/tools/install.sh
@Tynael
Tynael / README.md
Last active February 18, 2026 00:49
How to use npx to run gist based scripts

Pip is a package manager of python. You can download Python libraries from some Python repositories like PyPI. You can also download libraries from a git repository. This is gonna be the issue to be explained in this article.

I don't like to memorize things all the time. So, I guess, I couldn't be working without internet :). Whenever I need to install some python libraries from a git repositories, I see a lot of way to do it. It is really confusing. This should be the reason why I can't memorize it. I can see how a very simple requirement is handled with to many confusing way. There shouldn't be to many way. Some of them is not working neither. At last, I decided to blog it.

As you may know, you can use two protocols which are http and ssh to do something on git repositories. Using protocol ssh instead of http may provide some ease of use. Because of nature of ssh, you can do something with your primary/public keys. So, you don't have to input your credentials all the time. But I'll be

kafka 集群安全认证配置

本文主要介绍下 kafka 0.10.0 版如何实现sasl/plain认证机制及权限控制

kafka安全机制

kakfa 的安全机制主要分为两部分:

  • 身份认证(Authentication): 对客户端的身份进行认证
  • 权限控制(Authorization): 对topic级别的权限进行控制

kafka 身份认证

kafka 目前支持 SSL,SASL(Kerberos),SASL(PLAIN) 三种认证机制。

@nanmu42
nanmu42 / update_tmux.sh
Last active January 14, 2026 15:57
Update tmux to latest version
#!/usr/bin/env bash
set -e
# dependecies
apt update
apt install -y git automake build-essential pkg-config libevent-dev libncurses5-dev byacc
# where our temp file locates
rm -rf /tmp/tmux
@kevinclcn
kevinclcn / manual.md
Last active September 21, 2024 05:50
pandoc导出中文pdf的模板

http://code.haleby.se/2017/01/27/markdown-to-pdf-in-macosx/

  • 安装pandoc,mactex和xelatex
  • 命令行程序都在/Libarary/Tex/Root/bin/x86_64-darwin/下面,需要将pdflatex, xelatex, tlmgr链接到/user/local/bin下面
  • 需要使用tlmgr安装titling, lastpage
  • 需要提供一个导出pdf的latex模板,默认的模板不支持中文
  • 调用命令生成pdf

pandoc --pdf-engine=xelatex --template=template accesstoken.md create.md customer.md customerevent.md list.md tag.md -o customer.pdf