Skip to content

Instantly share code, notes, and snippets.

View alexcrownus's full-sized avatar

Adesegun Adeyemo alexcrownus

View GitHub Profile
@alexcrownus
alexcrownus / GCPAuthenticationInterceptor.java
Created August 23, 2023 21:49 — forked from tylertreat/GCPAuthenticationInterceptor.java
Spring RestTemplate interceptor which can make HTTP requests to Google OIDC-authenticated resources using a service account
package com.realkinetic.gcp.spring.oidc;
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.google.api.client.http.*;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonObjectParser;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.GenericData;

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)
@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:

@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 / 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;
}
package main
import (
"bufio"
"encoding/csv"
"encoding/json"
"fmt"
"io"
"os"
"path/filepath"
// 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 pool
type Task interface {
Execute(id int)
}
type Pool struct {
tasks chan Task
kill chan bool
}
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
@alexcrownus
alexcrownus / golang_job_queue.md
Created January 9, 2017 01:21 — forked from harlow/golang_job_queue.md
Job queues in Golang