Skip to content

Instantly share code, notes, and snippets.


Sam Bessalah samklr

Block or report user

Report or block samklr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
samklr /
Created Apr 20, 2015
Install Protobuf debian ...
#! /bin/bash
tar xzf protobuf-2.6.1.tar.gz
cd protobuf-2.6.1
sudo apt-get update
sudo apt-get install build-essential
sudo ./configure
sudo make
sudo make check
sudo make install
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
samklr /
Created Oct 11, 2019 — forked from denji/
Simple Golang HTTPS/TLS Examples

Moved to git repository:

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
samklr / OffsetMngHbase.scala
Last active Aug 24, 2019
Offset Management on HBase
View OffsetMngHbase.scala
Save offsets for each batch into HBase
def saveOffsets(TOPIC_NAME:String,GROUP_ID:String,offsetRanges:Array[OffsetRange],
hbaseTableName:String,batchTime: org.apache.spark.streaming.Time) ={
val hbaseConf = HBaseConfiguration.create()
val conn = ConnectionFactory.createConnection(hbaseConf)
val table = conn.getTable(TableName.valueOf(hbaseTableName))
val rowKey = TOPIC_NAME + ":" + GROUP_ID + ":" +String.valueOf(batchTime.milliseconds)

I've been working with Kafka for over 7 years. I inevitably find myself doing the same set of activities while I'm developing or working with someone else's system. Here's a set of Kafka productivity hacks for doing a few things way faster than you're probably doing them now. 🔥

Get the tools

apt-get install \
build-essential \
git \
gradle \
git clone
cd airpal
./gradlew clean shadowJar
mysql \
samklr / AccumulatorListener.scala
Created Aug 2, 2016
Spark Accumulator Metrics
View AccumulatorListener.scala
import scala.collection.mutable.Map
import org.apache.spark.{Accumulator, AccumulatorParam, SparkContext}
import org.apache.spark.scheduler.{SparkListenerStageCompleted, SparkListener}
import org.apache.spark.SparkContext._
* just print out the values for all accumulators from the stage.
* you will only get updates from *named* accumulators, though
samklr / HealthStatus.scala
Created May 23, 2019 — forked from m-wrona/HealthStatus.scala
[Akka] Service health-check
View HealthStatus.scala
import{ ActorSystem, Props }
import com.typesafe.config.Config
import com.typesafe.scalalogging.LazyLogging
import spray.can.Http
sealed class HealthStatusService(actorNames: List[String], webConfig: Config)(implicit system: ActorSystem) extends LazyLogging {
private[status] val healthCheckPath: String = webConfig.getString("status-path")
private[status] val timeoutDuration: Int = webConfig.getInt("timeout")
samklr /
Created May 20, 2019 — forked from davideicardi/
Scala AES-CTR encryption, MAC, HMAC, ... with Bouncy Castle example

Scala AES-CTR encryption Bouncy Castle example

Add the following library:

libraryDependencies += "org.bouncycastle" % "bcprov-jdk16" % "1.46"


You can’t perform that action at this time.