Skip to content

Instantly share code, notes, and snippets.

@ayushgp
ayushgp / hasura-migrate.sh
Last active March 11, 2021 02:45
Take Hasura migrations from one server and apply them to another
# Take Hasura migrations from staging and apply them to prod
# Usage: ./migrate.sh "<staging-endpoint>" "<staging-secret>" "<prod-endpoint>" "<prod-secret>" "<migration-name>"
STAGING_ENDPOINT="$1"
STAGING_SECRET="$2"
PROD_ENDPOINT="$3"
PROD_SECRET="$4"
MIGRATION_NAME="$5"
@adamhjk
adamhjk / service.rs
Created May 28, 2020 14:34
tonic with tracing, opentelemetry, and context propagation
use opentelemetry::api::propagation::text_propagator::HttpTextFormat;
use tracing::{debug, info};
use tracing_futures::Instrument as _;
use tracing_opentelemetry::OpenTelemetrySpanExt as _;
#[tonic::async_trait]
impl crate::protobuf::kubernetes_server::Kubernetes for Service {
async fn kubernetes_deployment_component_get(
&self,
mut request: tonic::Request<crate::protobuf::KubernetesDeploymentComponentGetRequest>,
@keathley
keathley / .credo.exs
Last active December 30, 2023 16:13
Keathley's credo file
# This file contains the configuration for Credo and you are probably reading
# this after creating it with `mix credo.gen.config`.
#
# If you find anything wrong or unclear in this file, please report an
# issue on GitHub: https://github.com/rrrene/credo/issues
#
%{
#
# You can have as many configs as you like in the `configs:` field.
configs: [
@jerry73204
jerry73204 / actix-kafka-example.rs
Created July 27, 2019 11:55
rdkafka integration with actix example
use actix::prelude::*;
use failure::Fallible;
use rdkafka::{
consumer::stream_consumer::StreamConsumer,
message::OwnedMessage,
Message,
};
pub struct MsgConsumer {
consumer: &'static StreamConsumer,
use std::collections::HashMap;
use std::fmt;
use std::io;
use std::num::ParseFloatError;
use std::rc::Rc;
/*
Types
*/

Build or install nghttp2 (optionally with support for the --interval DURATION flag).

Either:

brew install nghttp2

Or:

// Suppose you have a variable named `future` which implements the `Future` trait.
let future: impl Future = ...;
// This gist demonstrates how to run the future until completion using the `stdweb` crate.
// The various imports.
extern crate futures;
extern crate stdweb;
@marwei
marwei / how_to_reset_kafka_consumer_group_offset.md
Created November 9, 2017 23:39
How to Reset Kafka Consumer Group Offset

Kafka 0.11.0.0 (Confluent 3.3.0) added support to manipulate offsets for a consumer group via cli kafka-consumer-groups command.

  1. List the topics to which the group is subscribed
kafka-consumer-groups --bootstrap-server <kafkahost:port> --group <group_id> --describe

Note the values under "CURRENT-OFFSET" and "LOG-END-OFFSET". "CURRENT-OFFSET" is the offset where this consumer group is currently at in each of the partitions.

  1. Reset the consumer offset for a topic (preview)
@avocade
avocade / erl-observe.sh
Created February 22, 2017 12:34
Connect to remote erlang node with remote iex session (eg over k8s port-forwarding), and start observer on it
#!/bin/bash
# This script provides easy way to debug remote Erlang nodes that is running in a kubernetes cluster.
# Usage: ./erl-observe.sh -l app=my_all -n default -c erlang_cookie
#
# Don't forget to include `:runtime_tools` in your mix.exs application dependencies.
set -e
# Trap exit so we can try to kill proxies that has stuck in background
function cleanup {
echo " - Stopping kubectl proxy."