Skip to content

Instantly share code, notes, and snippets.

View vitorpacheco's full-sized avatar

Vitor Pacheco vitorpacheco

  • Solutis Tecnologias
  • Brasil, Salvador - BA
View GitHub Profile
@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)
import os
import boto.utils
import boto3
import requests
import datetime
import time
def get_contents(filename):
<?php
/**
* Custom redis client class to be able to set a custom prefix for every key
*
* @see https://github.com/nicolasff/phpredis
**/
class RedisClient extends Redis {
/**
* Default prefix
@zenorocha
zenorocha / multiple-3rd-party-widgets.js
Last active November 14, 2022 12:18
Loading multiple 3rd party widgets asynchronously
(function() {
var script,
scripts = document.getElementsByTagName('script')[0];
function load(url) {
script = document.createElement('script');
script.async = true;
script.src = url;
scripts.parentNode.insertBefore(script, scripts);
@simkimsia
simkimsia / installation-12-10-ubuntu.sh
Last active February 12, 2020 10:46
preparing a fresh 12.10 ubuntu server for cakephp 2.4
#!/bin/bash
###
#
# forked from https://gist.github.com/1264701/08f93534ba177f173b9382b53c419cd0de5b07ea
# Copyright (c) 2011 Cake Development Corporation (http//cakedc.com)
#
# Ubuntu 12.10 based web server installation script
# Run this by executing the following from a fresh install of Ubuntu 12.10 server:
#
@junichi11
junichi11 / composer.json
Created October 3, 2012 11:33
Composer template for CakePHP Plugin
{
"name": "vendor/plugin_name",
"type": "cakephp-plugin",
"description": "Moge Plugin for CakePHP",
"keywords": ["cakephp","moge"],
"homepage": "https://github.com/yousername/your_plugin",
"license": "MIT",
"authors": [
{
"name": "hoge moge",
@naraga
naraga / PCQueueDemo.cs
Created September 18, 2012 22:08
Producer / Consumer queue optimized for IO bound operations
class Program
{
// PcQueue - demo
// Code copied from "C# 5.0 in a Nutshell: The Definitive Reference" by Joseph Albahari and Ben Albahari
// Modified by @borisbucha to efficiently support IO bound operations (simply adding TaskCreationOptions.LongRunning to consumer tasks)
// which sugests to scheduler to allocate dedicated thread to enqued items instead of poluting Threadpool.
static void Main()
{
Console.WriteLine("press any key when ready");
Console.ReadLine();
@jswebschmiede
jswebschmiede / snippet.js
Created September 6, 2012 22:31 — forked from necolas/snippet.js
Optimised async loading of cross-domain scripts
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
* Tip: http://pivotallabs.com/users/jdean/blog/articles/1400-working-with-asynchronously-loaded-javascript
*/
(function(doc, script) {
var js,
@casimiroarruda
casimiroarruda / build.xml
Created February 28, 2012 01:59
Arquivo de configuração para o phing
<?xml version="1.0" encoding="UTF-8"?>
<project name="TheProject" default="build" basedir=".">
<!-- Altere estas propriedades adequando-as ao seu projeto -->
<property name="application.library" value="${project.basedir}/library"/>
<property name="application.tests" value="${project.basedir}/tests"/>
<property name="application.builddir" value="${project.basedir}/build"/>
<target name="build"
@slywalker
slywalker / pagination.ctp
Created October 5, 2011 07:25
pagination element for CakePHP on twitter bootstrap
<?php
if (!isset($modules)) {
$modulus = 11;
}
if (!isset($model)) {
$models = ClassRegistry::keys();
$model = Inflector::camelize(current($models));
}
?>
<div class="pagination">