Skip to content

Instantly share code, notes, and snippets.

View vaxilicaihouxian's full-sized avatar

CHENCHI MA vaxilicaihouxian

View GitHub Profile
@rubenvp8510
rubenvp8510 / collector cmd
Last active June 25, 2021 02:43
Kafka SSL configuration
./jaeger-collector --collector.zipkin.http-port=9411 \
--span-storage.type kafka \
--kafka.producer.authentication=tls \
--kafka.producer.tls.ca=/home/rvargasp/kafka_2.12-2.2.1/config/ssl/ca-cert \
--kafka.producer.tls.cert=/home/rvargasp/kafka_2.12-2.2.1/config/ssl/cert-client-signed \
--kafka.producer.tls.key=/home/rvargasp/kafka_2.12-2.2.1/config/ssl/client_key.pem \
--kafka.producer.brokers=kafka:9093 \
--kafka.producer.topic=jaeger \
--kafka.producer.encoding=json
@baryon
baryon / nginx-dev-ssl.md
Last active March 11, 2022 08:45 — forked from LeZuse/nginx-dev-ssl.sh
配合nginx在本地开发https后端服务器

在开发后端服务时, APP中已经写好了服务器地址, 如何在本地开发机器调试呢? 首先,需要设置本地机器的hosts。 最方便的工具是gas masks https://github.com/2ndalpha/gasmask

添加类似如下代码

127.0.0.1		dev.example.com

生成本地证书 copy default OpenSSL config

@rushilgupta
rushilgupta / GoConcurrency.md
Last active July 11, 2024 12:52
Concurrency in golang and a mini Load-balancer

INTRO

Concurrency is a domain I have wanted to explore for a long time because the locks and the race conditions have always intimidated me. I recall somebody suggesting concurrency patterns in golang because they said "you share the data and not the variables".

Amused by that, I searched for "concurrency in golang" and bumped into this awesome slide by Rob Pike: https://talks.golang.org/2012/waza.slide#1 which does a great job of explaining channels, concurrency patterns and a mini-architecture of load-balancer (also explains the above one-liner).

Let's dig in:

Goroutines

@ethicka
ethicka / localhost-ssl-certificate.md
Last active July 12, 2024 10:00
Localhost SSL Certificate on Mac OS

🚨 2020 Update: I recommend using mkcert to generate local certificates. You can do everything below by just running the commands brew install mkcert and mkcert -install. Keep it simple!


This gives you that beautiful green lock in Chrome. I'm assuming you're putting your SSL documents in /etc/ssl, but you can put them anywhere and replace the references in the following commands. Tested successfully on Mac OS Sierra and High Sierra.

Set up localhost.conf

sudo nano /etc/ssl/localhost/localhost.conf

@uudashr
uudashr / main.go
Last active October 2, 2023 21:09
Listening for signal termination in Golang (AKA shutdown hook)
package main
import (
"fmt"
"log"
"os"
"os/signal"
"syscall"
)
local char_to_hex = function(c)
return string.format("%%%02X", string.byte(c))
end
local function urlencode(url)
if url == nil then
return
end
url = url:gsub("\n", "\r\n")
url = url:gsub("([^%w ])", char_to_hex)
@yowu
yowu / HttpProxy.go
Last active July 19, 2024 12:41
A simple HTTP proxy by Golang
package main
import (
"flag"
"io"
"log"
"net"
"net/http"
"strings"
)
@guillaumevoisin
guillaumevoisin / php-cs-fixer-git-files
Created June 18, 2015 10:05
PHP-CS-Fixer on modified files
git diff --name-only --cached --diff-filter=ACMRTUXB | while read filename; do php-cs-fixer --level=symfony fix $filename; done;
@danharper
danharper / CatchAllOptionsRequestsProvider.php
Last active April 20, 2024 01:53
Lumen with CORS and OPTIONS requests
<?php namespace App\Providers;
use Illuminate\Support\ServiceProvider;
/**
* If the incoming request is an OPTIONS request
* we will register a handler for the requested route
*/
class CatchAllOptionsRequestsProvider extends ServiceProvider {
@denji
denji / golang-tls.md
Last active July 1, 2024 05:41 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)