Skip to content

Instantly share code, notes, and snippets.

View romanskie's full-sized avatar
🌯

Roman Schader romanskie

🌯
View GitHub Profile
@romanskie
romanskie / cd_into_everything.sh
Last active January 7, 2020 09:56
bash alias that allows to pass files or dirs to the unix cd comand
# pass files or dirs to cd
cd_ () {
if [[ -d ${1} ]]; then
#echo ${1} is a directory"
cd ${1}
elif [[ -f ${1} ]]; then
#echo ${1} is a file"
cd $(dirname "${1}")
else
#echo ${1} is not valid"
@romanskie
romanskie / KafkaJsonSerde.scala
Last active June 16, 2020 07:50
A sample Kafka JSON SerDe written in Scala by using the Circe JSON library.
import java.nio.ByteBuffer
import java.util
import io.circe.parser._
import io.circe.syntax._
import io.circe.{Decoder, Encoder, _}
import org.apache.kafka.common.errors.SerializationException
import org.apache.kafka.common.serialization.{Deserializer, Serde, Serializer}
import scala.util.Try
@romanskie
romanskie / solutions_to_5_sw_problems.py
Last active December 22, 2023 07:25
Solutions to 5 problems every software engineer should be able to solve (in less than 1 hour)
import re
# Problem 1
# ---------
# Write three functions that compute the sum of the numbers in a given list
# using a for-loop, a while-loop, and recursion.
input_1 = [1, 2, 3, 4, 5] #15
def p1_for(lst):
c = 0