Skip to content

Instantly share code, notes, and snippets.

View alexcrownus's full-sized avatar

Adesegun Adeyemo alexcrownus

View GitHub Profile
#!/bin/bash
set -e
GVERSION="1.7.1"
GFILE="go$GVERSION.linux-amd64.tar.gz"
GOPATH="$HOME/gocode"
GOROOT="/usr/local/go"
if [ -d $GOROOT ]; then
echo "Installation directories already exist $GOROOT"
@alexcrownus
alexcrownus / golang_job_queue.md
Created January 9, 2017 01:21 — forked from harlow/golang_job_queue.md
Job queues in Golang
package main
const MaxLength = 1 << 20
var (
addr = flag.String("listen", ":8000", "listen for requests")
numprocs = flag.Int("p", runtime.NumCPU(), "number of workers to start")
maxqueue = flag.Int("q", runtime.NumCPU()*2, "largest queue size")
jobs chan Job
package pool
type Task interface {
Execute(id int)
}
type Pool struct {
tasks chan Task
kill chan bool
}
// Worker represents the worker that executes the job
type Worker struct {
JobChannel chan Job
quit chan bool
}
func NewWorker(jobChannel chan Job) Worker {
return Worker{
JobChannel: jobChannel,
quit: make(chan bool)}
package main
import (
"bufio"
"encoding/csv"
"encoding/json"
"fmt"
"io"
"os"
"path/filepath"
@alexcrownus
alexcrownus / sol-wallet
Created August 25, 2017 17:20 — forked from bitgord/sol-wallet
Wallet Smart Contract Using Solidity
contract SimpleWallet {
// address is the owner
address owner;
struct WithdrawlStruct {
address to;
uint amount;
}
@alexcrownus
alexcrownus / create_migration.sh
Created August 24, 2020 22:21 — forked from MarkyMarkMcDonald/create_migration.sh
Create Flyway migration versioned by timestamp: ./bin/create_migration.sh "Add_Unique_Constraint_To_User_Email"
#!/bin/bash
echo "-- New Migration" > "`dirname $0`/../src/main/resources/db/migrations/V`date +%s`__$1.sql"
@alexcrownus
alexcrownus / GitConfigHttpProxy.md
Created February 8, 2023 15:40 — forked from evantoli/GitConfigHttpProxy.md
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

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)