Skip to content

Instantly share code, notes, and snippets.

@marwei
marwei / how_to_reset_kafka_consumer_group_offset.md
Created Nov 9, 2017
How to Reset Kafka Consumer Group Offset
View how_to_reset_kafka_consumer_group_offset.md

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)
View vc-git-diff-word.el
;; Stolen from:
;; http://mikehucka.postach.io/post/modifying-emacss-vc-diff-for-word-oriented-diffs
;;
;; Improvements:
;; - Be smarter about adding --word-diff to `vc-git-diff-switches' and
;; not clobbering any existing settings.
;; - Use `defface' as the docstring for `make-face' recommends.
;; - Base face defaults on `diff-added' and `diff-removed'.
;; - Rename `vc-diff-deleted-face' to `vc-diff-removed-face' for
;; consistency with existing face naming conventions.
@josephspurrier
josephspurrier / sshclient.go
Last active May 31, 2022
Golang SSH Client
View sshclient.go
package main
import (
"bufio"
"io/ioutil"
"os/signal"
//"syscall"
"fmt"
"log"
"os"
@acdvorak
acdvorak / tmux-all-panes.sh
Last active Aug 6, 2021 — forked from yubink/inall.sh
tmux: run a command in all panes
View tmux-all-panes.sh
#!/bin/bash
# Runs the specified command (provided by the first argument) in all tmux panes
# in every window. If an application is currently running in a given pane
# (e.g., vim), it is suspended and then resumed so the command can be run.
all-panes()
{
all-panes-bg_ "$1" &
}
@Integralist
Integralist / 0. description.md
Last active Sep 2, 2021
Clojure deftype, defrecord, defprotocol
View 0. description.md
  • defprotocol: defines an interface
  • deftype: create a bare-bones object which implements a protocol
  • defrecord: creates an immutable persistent map which implements a protocol

Typically you'll use defrecord (or even a basic map);
unless you need some specific Java inter-op,
where by you'll want to use deftype instead.

Note: defprotocol allows you to add new abstractions in a clean way Rather than (like OOP) having polymorphism on the class itself,

@rabbitt
rabbitt / schema_clone.py
Last active Oct 8, 2020
PostgreSQL schema cloner (including data).
View schema_clone.py
import psycopg2 as pg
from io import BytesIO
from collections import defaultdict
from contextlib import contextmanager
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT, ISOLATION_LEVEL_READ_COMMITTED
READ_COMMIT = ISOLATION_LEVEL_READ_COMMITTED
AUTO_COMMIT = ISOLATION_LEVEL_AUTOCOMMIT
View gist:7918ab45d0081c806f7e
[bigq_buffer]
type = "SandboxFilter"
ticker_interval = 30
script_type = "lua"
filename = "<path_to_lua>"
preserve_data = true
message_matcher = 'Logger == "boundary_haproxy"'
[bigq_buffer.config]
num_buff_rows = 100
preservation_version = 1
@tamastimar
tamastimar / nextWindow.lua
Last active Apr 12, 2021
Hammerspoon (http://hammerspoon.org) script to switch to next window of frontmost app in OS X
View nextWindow.lua
-- Window Manipulation
-- Bind alt-Tab to show next window of current application
hs.hotkey.bind({"alt"}, "Tab", function()
local app = hs.application.frontmostApplication()
local windows = app:allWindows()
local nextWin = nil
@gubatron
gubatron / multiple-deploy-keys-multiple-private-repos-github-ssh-config.md
Last active Aug 5, 2022
How to configure multiple deploy keys for different private github repositories on the same computer without using ssh-agent
View multiple-deploy-keys-multiple-private-repos-github-ssh-config.md

How to configure multiple deploy keys for different private github repositories on the same computer without using ssh-agent

Let's say alice is a github.com user, with 2 or more private repositories repoN. For this example we'll work with just two repositories named repo1 and repo2

https://github.com/alice/repo1

https://github.com/alice/repo2

You need to be to pull from these repositories without entering a passwords probably on a server, or on multiple servers.