Skip to content

Instantly share code, notes, and snippets.

View cashlalala's full-sized avatar

cashlalala cashlalala

  • Taipei, Taiwan
View GitHub Profile
@cashlalala
cashlalala / elasticsearch.md
Created January 21, 2025 14:45 — forked from gomaglev/elasticsearch.md
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.

@cashlalala
cashlalala / 2019-https-localhost.md
Created March 29, 2024 12:20 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@cashlalala
cashlalala / tls-ca.go
Created July 20, 2023 04:19 — forked from ashee/tls-ca.go
golang tls with self-signed cert
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"net/http"
)
origin dest count time
1 2 27.7
1 3 34.7
1 4 21.2 https://flowmap.blue/od-matrix-converter
1 5 1.4
1 6 18.9
1 9 37.1
1 8 46.1
2 1 25.7
2 3 10.6
@cashlalala
cashlalala / ipfs-main.json
Created August 12, 2022 04:52 — forked from jamiew/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",
@cashlalala
cashlalala / TestHttpClient45IgnoreSSLErrors.java
Created July 1, 2022 05:46 — forked from wellsb1/TestHttpClient45IgnoreSSLErrors.java
HttpClient 4.5 Ignore SSL Errors and Warnings
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
@cashlalala
cashlalala / Program.cs
Created September 13, 2021 08:18 — forked from DanielSWolf/Program.cs
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);
@cashlalala
cashlalala / ProcessAsyncHelper.cs
Created April 16, 2021 06:41 — forked from AlexMAS/ProcessAsyncHelper.cs
The right way to run external process in .NET (async version)
using System;
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
public static class ProcessAsyncHelper
{
public static async Task<ProcessResult> ExecuteShellCommand(string command, string arguments, int timeout)
{
var result = new ProcessResult();
@cashlalala
cashlalala / Program.cs
Created March 17, 2021 01:19 — forked from andrewloable/Program.cs
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);