Skip to content

Instantly share code, notes, and snippets.

View maxjustus's full-sized avatar

Max Justus Spransy maxjustus

  • People With Jetpacks
  • Los Angeles, CA
View GitHub Profile
@amulyakashyap09
amulyakashyap09 / elastic_search_query.md
Last active January 13, 2025 18:06
How to query in elastic-search

Terminologies

We will be using following information throughout this article:

  • index_name : customers
  • index_type : personal
  • customer will have name,age,gender,email,phone,address,city,state as fields in schema for now

INFO Queries

# A basic re-implementation of gron in JQ
# Operates in a streaming manner, without having to read the entire input first or hold it in memory
# Try: cat big.json | while read; do printf '%s\n' "$REPLY"; sleep 0.1; done | jqgron
# Most operations are slower than gron, but `jqgron -u -j` is actually faster!
def topath:
map(if (tostring|test("\\A[[:alpha:]$_][[:alnum:]$_]*\\z")|not)
then "[\(tojson)]" else ".\(.)" end) | join("");
def tojqpath:
topath | if .[0:1] == "[" then "." + . else . end;
@den-crane
den-crane / MV_poplulating_with_freeze.sql
Last active January 28, 2025 20:44
MV_poplulating_with_freeze
create table source (A Int64, B String) Engine=MergeTree order by A;
insert into source values(1,'1');
--
-- stop ingestion
--
alter table source freeze;
create materialized view newMV Engine=SummingMergeTree order by A
@0x1b-xyz
0x1b-xyz / eap_proxy-udmpro-health.sh
Last active November 28, 2025 03:49
A script that manages the lifecycle of the eap_proxy-udmpro container on a UDM PRO between reboots or firmware updates. See https://github.com/pbrah/eap_proxy-udmpro for the upstream image.
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
TARGET_HOST="${TARGET_HOST:?"You must define TARGET_HOST"}"
PASSWORD_FILE="${PASSWORD_FILE:?"You must define PASSWORD_FILE"}"
EAP_PROXY_IMAGE="${EAP_PROXY_IMAGE:-"pbrah/eap_proxy-udmpro:v1.1"}"
HC_CONTAINER_NAME="eap_proxy-healthcheck"
UDM_CONTAINER_NAME="eap_proxy-udmpro"
@ivormetcalf
ivormetcalf / upload_stream.rs
Last active April 25, 2024 20:28
Rust Module to upload a stream to Amazon S3.
use rusoto_core::ByteStream;
use rusoto_s3::{S3Client, S3};
use futures::{future, stream, Stream, StreamExt, TryStreamExt};
pub async fn upload_stream(
client: S3Client,
bucket: String,
key: String,
data_stream: impl Stream<Item = String>,
@octosteve
octosteve / genserver.rb
Created December 11, 2020 00:22
GenServer implementation in Ruby
class Stack
def self.start_link(state)
GenServer.start_link(new(state))
end
def self.push(ractor, value)
GenServer.cast(ractor, [:push, value])
end
def self.pop(ractor)
@joseluisq
joseluisq / main.rs
Created February 10, 2021 22:23 — forked from lu4nm3/main.rs
Tokio Async: Concurrent vs Parallel
use futures::StreamExt;
use std::error::Error;
use tokio;
use tokio::macros::support::Pin;
use tokio::prelude::*;
use tokio::time::{Duration, Instant};
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut multi_threaded_runtime = tokio::runtime::Builder::new()
.threaded_scheduler()
@sbailliez
sbailliez / vagrant-vmware-tech-preview-apple-m1-pro.md
Last active May 23, 2025 19:01
Vagrant and VMWare Tech Preview 21H1 on Apple M1 Pro

Vagrant and VMWare Tech Preview 21H1 on Apple M1 Pro

UPDATE November 20, 2022: VMWare Fusion 13

VMWare Fusion 13 is now released. Read Vagrant and VMWare Fusion 13 Player on Apple M1 Pro for the latest.

Summary

This document summarizes notes taken while to make the VMWare Tech preview work on Apple M1 Pro, it originated

@tuxedocat
tuxedocat / lima_docker_rootless.yaml
Last active February 21, 2023 17:07
lima-vm setting: Rootless docker with both TCP/UNIX Socket connection (I personally use this setting for buildpacks)
# Example to use Docker instead of containerd & nerdctl
# $ limactl start ./lima_docker_rootless.yaml
# $ limactl shell lima_docker_rootless docker run -it -v $HOME:$HOME --rm alpine
# To run `docker` on the host (assumes docker-cli is installed):
# $ export DOCKER_HOST=unix://$HOME/docker.sock
# $ docker ...
# This example requires Lima v0.7.3 or later
# CPUs: if you see performance issues, try limiting cpus to 1.
@StevenTCramer
StevenTCramer / Dotnet_Background_Jobs
Last active May 7, 2024 11:48
If you are queuing background jobs/work items today in your .NET applications, how are you doing it and what are you using it for?
David Fowler 🇧🇧🇺🇸💉💉💉 on Twitter: "If you are queuing background jobs/work items today in your .NET applications, how are you doing it and what are you using it for? #dotnet #aspnetcore" / Twitter
https://twitter.com/davidfowl/status/1442566223099666436
Background tasks with hosted services in ASP.NET Core | Microsoft Docs
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-6.0&tabs=visual-studio
Messaging that just works — RabbitMQ
https://www.rabbitmq.com/
.NET/C# Client API Guide — RabbitMQ