Skip to content

Instantly share code, notes, and snippets.

View kelein's full-sized avatar
🤒
Out sick

Kallen Ding kelein

🤒
Out sick
  • Kuiper Belt
View GitHub Profile
@kelein
kelein / _struct_to_map.go
Created January 13, 2023 07:29 — forked from bxcodec/_struct_to_map.go
Golang Struct To Map Example By JSON tag
/*
This function will help you to convert your object from struct to map[string]interface{} based on your JSON tag in your structs.
Example how to use posted in sample_test.go file.
*/
func structToMap(item interface{}) map[string]interface{} {
res := map[string]interface{}{}
if item == nil {
return res
}
@kelein
kelein / main.go
Created September 30, 2022 02:31 — forked from fl64/main.go
golang prometheus exporter example
package main
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"log"
"math/rand"
"net/http"
"time"
@kelein
kelein / main.go
Created July 15, 2022 07:08 — forked from roidelapluie/main.go
Read Alertmanager NFLOG
package main
import (
"errors"
"flag"
"fmt"
"io"
"os"
"github.com/gogo/protobuf/jsonpb"
@kelein
kelein / uwgi-medium-post.ini
Created April 21, 2022 02:42 — forked from sumitsk20/uwgi-medium-post.ini
uwsgi configuration with most commonly sused options for highly scalable website (medium blog post)
[uwsgi]
# telling user to execute file
uid = bunny
# telling group to execute file
gid = webapps
# name of project you during "django-admin startproject <name>"
project_name = updateMe
@kelein
kelein / nvidia-elementaryos-loki.md
Created October 13, 2018 05:51 — forked from Jiab77/nvidia-elementaryos-loki.md
nVidia drivers installation on ElementaryOS - Loki (ubuntu 16.04 based distrib)

nVidia drivers installation on ElementaryOS - Loki

Introduction

ElementaryOS - Loki is an amazing ubuntu based distribution, I've just felt in love on it BUT they've removed what's required to install easily the nVidia Proprietary drivers. So here is the reason of this gist, to store the install instructions in one place inside a crystal clear documentation.

Check your device

@kelein
kelein / custom-loki.sh
Created September 28, 2018 19:48 — forked from evertontrindade/custom-loki.sh
Things to do after install Elementary OS Loki (0.4)
# First you update your system
sudo apt-get update && sudo apt-get dist-upgrade
# Clean-up System
sudo apt-get purge epiphany-browser epiphany-browser-data #browser
sudo apt-get purge midori-granite #browser
sudo apt-get purge noise
sudo apt-get purge scratch-text-editor #text-editor
sudo apt-get purge modemmanager
sudo apt-get purge geary #email
@kelein
kelein / git-branch.md
Created September 19, 2018 16:42 — forked from yisibl/git-branch.md
在Mac、Linux 终端显示 Git 当前所在分支

在Mac、Linux 终端显示 Git 当前所在分支

  1. 进入你的home目录
cd ~
  1. 编辑.bashrc文件
@kelein
kelein / docker-compose-grafana.yml
Created July 17, 2018 03:08
Grafana on Docker
version: "2"
services:
grafana:
image: grafana/grafana:5.1.0
ports:
- 3000:3000
user: 'root'
volumes:
- ./grafana.ini:/etc/grafana/grafana.ini
@kelein
kelein / Dockerfile
Created June 27, 2018 12:53 — forked from dukelion/Dockerfile
Rocksdb tools image
# docker-rocksdb
Alpine Linux image with compiled and installed RocksDB with all compression libraries
dukelion@x1-carbon:~/source/docker-rocksdb$ cat Dockerfile
FROM golang:1.8-alpine
RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >>/etc/apk/repositories && \
echo "@community http://nl.alpinelinux.org/alpine/edge/community" >>/etc/apk/repositories
RUN apk add --update --no-cache build-base linux-headers git cmake bash #wget mercurial g++ autoconf libgflags-dev cmake bash jemalloc perl
RUN apk add --update --no-cache zlib zlib-dev bzip2 bzip2-dev snappy snappy-dev lz4 lz4-dev zstd@community zstd-dev@community jemalloc jemalloc-dev libtbb-dev@testing libtbb@testing
@kelein
kelein / zookeeperKafka.py
Created May 8, 2018 07:58 — forked from tromika/zookeeperKafka.py
Python script to get Kafka Brokers from Zookeeper
from kazoo.client import KazooClient
import json
####
# A quick function to get Kafka brokers from Zookeeper
###
# Probably you need only the first one because the broker will advertise the other brokers
# This is need only for producers due there you can only use bootstrap servers
# Arguments