Skip to content

Instantly share code, notes, and snippets.

Avatar

Ron RonBarabash

  • Yotpo
  • Israel
View GitHub Profile
View same_site.go
package main
import (
"regexp"
"strconv"
)
// Don’t send `SameSite=None` to known incompatible clients.
func shouldSendSameSiteNone(useragent string) (bool, error) {
sameSiteNoneIncompatible, err := isSameSiteNoneIncompatible(useragent)
View KafkaConsumer.scala
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 Mar 18, 2021
Measuring consumer lag in Spark Structured Streaming
View KafkaLagWriter.scala
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 Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View salesforce.rb
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