Skip to content

Instantly share code, notes, and snippets.

View RonBarabash's full-sized avatar

Ron RonBarabash

View GitHub Profile
package main
import (
"regexp"
"strconv"
)
// Don’t send `SameSite=None` to known incompatible clients.
func shouldSendSameSiteNone(useragent string) (bool, error) {
sameSiteNoneIncompatible, err := isSameSiteNoneIncompatible(useragent)
val props = new Properties()
props.put("bootstrap.servers", "127.0.0.1:9092")
props.put("group.id", "DummyConsumerGroupID")
props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer")
props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer")
new KafkaConsumer[String, String](props)
@RonBarabash
RonBarabash / KafkaLagWriter.scala
Last active December 19, 2022 11:19
Measuring consumer lag in Spark Structured Streaming
import java.util
import com.fasterxml.jackson.databind.{DeserializationFeature, ObjectMapper}
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import com.yotpo.metorikku.exceptions.MetorikkuException
import org.apache.kafka.clients.consumer.{KafkaConsumer, OffsetAndMetadata}
import org.apache.kafka.common.TopicPartition
import org.apache.spark.sql.streaming.StreamingQueryListener
import org.apache.spark.sql.streaming.StreamingQueryListener._
@RonBarabash
RonBarabash / salesforce.rb
Last active August 29, 2015 14:22
Here are some things you can do with Gists in GistBox.
integrations_conf = YAML.load_file("#{Rails.root}/config/integrations.yml")['production’]
Restforce.configure do |config|
config.username = integrations_conf['SALESFORCE']['USERNAME']
config.password = integrations_conf['SALESFORCE']['PASSWORD']
config.security_token = integrations_conf['SALESFORCE']['TOKEN']
config.client_id = integrations_conf['SALESFORCE']['CLIENT_ID']
config.client_secret = integrations_conf['SALESFORCE']['CLIENT_SECRET']
config.host = integrations_conf['SALESFORCE']['HOST'] if integrations_conf['SALESFORCE']['HOST'].present?a
end
client = Restforce.new