Skip to content

Instantly share code, notes, and snippets.

@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)
@toja
toja / .block
Last active March 8, 2023 00:26
Perlin noise - 3D Demo
license: gpl-3.0
height: 480
border: no
@genekogan
genekogan / scrapeImages.py
Created February 22, 2017 11:49
scraping full size images from Google Images
from bs4 import BeautifulSoup
import requests
import re
import urllib2
import os
import argparse
import sys
import json
# adapted from http://stackoverflow.com/questions/20716842/python-download-images-from-google-image-search
@arxdsilva
arxdsilva / working_directory.go
Last active January 6, 2025 19:29
How to get the current working directory in golang
package main
// More info on Getwd()
// https://golang.org/src/os/getwd.go
//
import(
"os"
"fmt"
"log"
)
@valyala
valyala / README.md
Last active November 4, 2025 00:19
Optimizing postgresql table for more than 100K inserts per second

Optimizing postgresql table for more than 100K inserts per second

  • Create UNLOGGED table. This reduces the amount of data written to persistent storage by up to 2x.
  • Set WITH (autovacuum_enabled=false) on the table. This saves CPU time and IO bandwidth on useless vacuuming of the table (since we never DELETE or UPDATE the table).
  • Insert rows with COPY FROM STDIN. This is the fastest possible approach to insert rows into table.
  • Minimize the number of indexes in the table, since they slow down inserts. Usually an index on time timestamp with time zone is enough.
  • Add synchronous_commit = off to postgresql.conf.
  • Use table inheritance for fast removal of old data:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RabbitMQ.Client.Events;
using Verify.Platform.Infrastructure.RabbitMQ.Producers;
namespace Verify.Platform.Infrastructure.RabbitMQ
{
public interface IRabbitUtilityService
@TimShi
TimShi / Using s3video Jekyll Plugin.md
Last active March 4, 2022 21:02
Using s3video Jekyll Plugin

Embed Responsive S3_Video On Jekyll Site

  1. Use S3_Video to publish your video on AWS S3.
  2. Add bootstrap css to your Jekyll site.
  3. Place the plugin for S3Video in your Jekyll site's _plugins directory
  4. Now you can use the following markdown in your Jekyll pages to embed the video. Replace your-s3-video-id-here with your own stream ID.
{% s3video your-s3-video-id-here %}
@Chandler
Chandler / slack_history.py
Last active March 27, 2025 01:16
Download Slack Channel/PrivateChannel/DirectMessage History
print("UPDATE AUG 2023: this script is beyond old and broken")
print("You may find interesting and more up to date resources in the comments of the gist")
exit()
from slacker import Slacker
import json
import argparse
import os
# This script finds all channels, private channels and direct messages
@HybridEidolon
HybridEidolon / README.md
Created November 24, 2015 06:51
PSOBB Wine Mipmaps Patch

PSOBB Wine mipmap patch

For Phantasy Star Online: Blue Burst versions 1.25.10-1.25.13 and the Wine 1.7/1.8 series.

PSOBB tries to write all mipmaps at once on a single LockRect on mip level 0. This is undocumented behavior in Direct3D and PSOBB will clobber the implementation structs if this is not accounted for.

These patches, based on the PlayOnLinux League of Legends patch, do two

<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//