Skip to content

Instantly share code, notes, and snippets.

View cashlalala's full-sized avatar

cashlalala cashlalala

  • Taipei, Taiwan
View GitHub Profile
@gomaglev
gomaglev / elasticsearch.md
Last active September 23, 2025 10:52
Elasticsearch Best Practice

Elasticsearch

Templates

Elasticsearch is index based storage. Many things need to be considered when creating indices such as properties, data types, number of shards, number of replicas, refresh interval. Elasticsearch doesn't have schemas. All these things can be set when creating the index or use a template to handle it. After template defined, all the indices that match "index_patterns" will apply all the properties in the template. By using templates, it becomes easier to change index settings, mappings and aliases.

@andrewloable
andrewloable / Program.cs
Created June 23, 2019 05:48
Use a library compiled in Go in c# (.net)
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace GoSharedDLL
{
class Program
{
[DllImport("shared.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
private static extern IntPtr ReturnReversedString(byte[] input);
@jamiew
jamiew / ipfs-main.json
Last active January 4, 2025 12:43 — forked from eefahy/ipfs-main.json
Grafana dashboard configuration for the IPFS Prometheus endpoint
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@christophlehmann
christophlehmann / prometheus-operator-kubernetes.yaml
Last active June 11, 2025 17:47
Example: Monitoring external server with Prometheus Operator
# First install prometheus-operator:
#
# helm install coreos/prometheus-operator --name prometheus-operator
#
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: node-exporter
# Namespace of prometheus operator
@alexanderadam
alexanderadam / Ansible Disk Check
Created September 15, 2018 12:40 — forked from mahemoff/Ansible Disk Check
Show disk space and warn about disk full in Ansible
* Shows a message while asserting like:
ok: [host] => {
"msg": "disk usage 4.2B of total 20.0GB (21.0%) (should exceed limit 90.0%)"
}
* Note this only looks at first mount point on current node
* Fails if disk is near-full
* Last step pushes to a push-based monitoring service, which will alert us if it doesn't get there after some time
* Need to setup a variable `disk_limit`, which is the max acceptable usage ratio, e.g. set it to 0.8 if you want to keep disks within 80% of max size
@jon-a-nygaard
jon-a-nygaard / README-Highcharts-Webpack-Babel.md
Last active October 30, 2020 18:50
A Highcharts example in use with Webpack and Babel.

A Highcharts example in use with Webpack and Babel.

Install

  1. Download source files
  2. Run npm install to install all dependencies.
  3. Run npm run build to bundle app.js into bundle.js

Open application

  1. Open index.html in a browser.
@procrastinatio
procrastinatio / haproxy_rate_limiting.md
Created October 25, 2017 06:04
Rate limiting with HAproxy

Introduction

So HAProxy is primalery a load balancer an proxy for TCP and HTTP. But it may act as a traffic regulator. It may also be used as a protection against DDoS and service abuse, by maintening a wide variety of statistics (IP, URL, cookie) and when abuse is happening, action as denying, redirecting to other backend may undertaken ([haproxy ddos config], [haproxy ddos])

@cashlalala
cashlalala / jenkins_http_trigger_cli.py
Last active April 18, 2018 06:11
trigger jenkins job via http, support parameter build, polling, inter-script session reuse, csrf enable/disable.
'''
Created on Oct 19, 2017
@author: cash.chang
'''
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
import json
import logging
import logging.config
import os
@ashee
ashee / tls-ca.go
Created October 18, 2017 17:20
golang tls with self-signed cert
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"net/http"
)