Skip to content

Instantly share code, notes, and snippets.

View JonathanLoscalzo's full-sized avatar

Jonathan Loscalzo JonathanLoscalzo

View GitHub Profile

Elastic Search

This document contains useful things about Elasticsearch

multi_match Query in Elasticsearch

The multi_match query is used to search for a given text across multiple fields in an Elasticsearch index.

It provides various types to control how the matching is executed and scored.

version: '3.8'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.14.1
container_name: elasticsearch
environment:
- bootstrap.memory_lock=true
- discovery.type=single-node
- xpack.security.enabled=false
@JonathanLoscalzo
JonathanLoscalzo / ex1
Last active July 1, 2024 17:01
llm zoomcamp - hw2
ollama -v (locally, not docker)
ollama version is 0.1.48
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#define CANT_PAL 10 // CANTIDAD DE PALABRAS
#define LONG_PAL 30 // LONGITUD MÁXIMA DE LAS PALABRAS
// AYUDAS
// funciones de caracteres
// #include <ctype.h>
@JonathanLoscalzo
JonathanLoscalzo / folder_structure.md
Created April 8, 2024 20:52 — forked from ayoubzulfiqar/folder_structure.md
The Folder Structure for Every Golang Project

Go - The Ultimate Folder Structure

Organizing your Go (Golang) project's folder structure can help improve code readability, maintainability, and scalability. While there is no one-size-fits-all structure, here's a common folder structure for a Go project:

project-root/
    ├── cmd/
    │   ├── your-app-name/
    │   │   ├── main.go         # Application entry point
    │   │   └── ...             # Other application-specific files
@JonathanLoscalzo
JonathanLoscalzo / dict_obj.py
Created March 15, 2024 19:08
DictObj alternative for python
# Similar to TypedDict but without typings
# allow access keys as fields
class DictObj:
def __init__(self, **kwargs):
self._update_internal_dict(dict(kwargs))
def _update_internal_dict(self, data: dict):
self.__dict__.update(data)
@JonathanLoscalzo
JonathanLoscalzo / iter_test.rs
Created March 15, 2024 00:15 — forked from philipjkim/iter_test.rs
Rust: Difference between iter(), into_iter(), and iter_mut()
#[test]
fn iter_demo() {
let v1 = vec![1, 2, 3];
let mut v1_iter = v1.iter();
// iter() returns an iterator of slices.
assert_eq!(v1_iter.next(), Some(&1));
assert_eq!(v1_iter.next(), Some(&2));
assert_eq!(v1_iter.next(), Some(&3));
assert_eq!(v1_iter.next(), None);
@JonathanLoscalzo
JonathanLoscalzo / cheatsheet.txt
Created February 1, 2024 16:43
kubernetes cheatsheet
Nodes
$ kubectl get no
$ kubectl get no -o wide
$ kubectl describe no
$ kubectl get no -o yaml
$ kubectl get node --select or =[ label _name]
$ kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="ExternalIP")].address}'
$ kubectl top node [node_name]
Pods
$ kubectl get po
@JonathanLoscalzo
JonathanLoscalzo / script.sh
Created February 1, 2024 15:22
Create an EKS cluster
eksctl create cluster --name dev --region us-east-1 --zones us-east-1a,us-east-1b,us-east-1c,us-east-1d,us-east-1f --nodegroup-name standard-workers --node-type t3.medium --nodes 3 --nodes-min 1 --nodes-max 4 --managed
cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf
overlay
br_netfilter
EOF
sudo modprobe overlay
sudo modprobe br_netfilter
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables = 1