Skip to content

Instantly share code, notes, and snippets.

View mancubus77's full-sized avatar
🇦🇺

Mancubus mancubus77

🇦🇺
  • Just a small software company
  • Ku-ring-gai
View GitHub Profile
@mancubus77
mancubus77 / gist:447281619be3731461b73dd4a18593c5
Last active July 31, 2023 08:40
Prometheus node exporter init.d (Centos6/RHEL6)
#!/bin/bash
#
# /etc/rc.d/init.d/node_exporter
#
# Prometheus node exporter
#
# description: Prometheus node exporter
# processname: node_exporter
# Source function library.
@mancubus77
mancubus77 / compile-haproxy.sh
Created April 4, 2018 23:24 — forked from meanevo/compile-haproxy.sh
Compile HAProxy from source on CentOS 7
# Make sure you have these installed
yum install -y make gcc perl pcre-devel zlib-devel
# Download/Extract source
wget -O /tmp/haproxy.tgz http://www.haproxy.org/download/1.7/src/haproxy-1.7.2.tar.gz
tar -zxvf /tmp/haproxy.tgz -C /tmp
cd /tmp/haproxy-*
# Compile HAProxy
# https://github.com/haproxy/haproxy/blob/master/README
make \
TARGET=linux2628 USE_LINUX_TPROXY=1 USE_ZLIB=1 USE_REGPARM=1 USE_PCRE=1 USE_PCRE_JIT=1 \
@mancubus77
mancubus77 / parse_json.go
Created August 14, 2018 12:47 — forked from mjohnsullivan/parse_json.go
Parse JSON objects with arbitrary key names in Go using interfaces and type assertions
// Parsing arbitrary JSON using interfaces in Go
// Demonstrates how to parse JSON with abritrary key names
// See https://blog.golang.org/json-and-go for more info on generic JSON parsing
package main
import (
"encoding/json"
"fmt"
)
@mancubus77
mancubus77 / flask-uwsgi-nginx-primer.md
Created November 21, 2018 12:35 — forked from mplewis/flask-uwsgi-nginx-primer.md
Flask + uWSGI + nginx Primer. I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.

Flask + uWSGI + nginx Primer

I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.

How this shit works

  • Flask is managed by uWSGI.
  • uWSGI talks to nginx.
@mancubus77
mancubus77 / .gitignore
Created April 29, 2019 22:49 — forked from hayajo/.gitignore
Keepalivedを使ったRedisのActive/Standby切り替え
.vagrant/
@mancubus77
mancubus77 / TileLayer.Common.js
Created June 12, 2019 07:14 — forked from mourner/TileLayer.Common.js
Leaflet shortcuts for common tile providers
// Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core?
L.TileLayer.Common = L.TileLayer.extend({
initialize: function (options) {
L.TileLayer.prototype.initialize.call(this, this.url, options);
}
});
(function () {
@mancubus77
mancubus77 / 01_IncreaseReplicationFactor.md
Created September 14, 2019 13:00 — forked from uarun/01_IncreaseReplicationFactor.md
Increase replication factor for __consumer_offsets Kafka topic

Increasing replication factor for a topic

  1. Create a custom reassignment plan (see attached file inc-replication-factor.json). In this case we are going from replication factor of 1 to 3.

  2. Run Kafka partition reassignment script:

    kafka-reassign-partitions --zookeeper $ZOOKEEPER_CONNECT \
        --reassignment-json-file /home/liquidnt/inc-replication-factor.json  \
        --execute
    
  3. Verify if the assignment was successful

> dig my-super-app.apps.ocp4.rhpg.org +short
192.168.50.1
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 3 columns, instead of 5 in line 4.
name,role,qty
Pipeline,Pipeline application consumer,3
Pipeline,Pipeline application producer,3
Kafka,Kafka Brokers,3
tsdb, Time Series Database (ClickHouse,VictoriaMetrics,Influx), 3
monitoring, Grafana and Prometheus, 2
@mancubus77
mancubus77 / influx metrics generator and kafka producer
Created January 8, 2021 00:37
kafka influx message generator
package main
import (
"fmt"
"time"
"math/rand"
"gopkg.in/confluentinc/confluent-kafka-go.v1/kafka"
)
func makeTimestamp() int64 {