Skip to content

Instantly share code, notes, and snippets.

View BillOTei's full-sized avatar
🏠
Working from home

Alex T BillOTei

🏠
Working from home
View GitHub Profile
@yamanyar
yamanyar / logback.xml
Created April 7, 2012 05:10
environment specific log back config
<configuration>
<if condition='"prd".equals(property("environment"))
|| "stg".equals(property("environment"))'>
<then>
<property name="APPLINK_LOG_LEVEL" value="warn"/>
</then>
<else>
<property name="APPLINK_LOG_LEVEL" value="debug"/>
</else>
@mistahenry
mistahenry / file_io.scala
Created April 19, 2014 21:56
Read file into List of lines in Scala
import scala.io.Source
val listOfLines = Source.fromFile("filename.txt").getLines.toList
@fancellu
fancellu / MergeSort.scala
Created November 25, 2015 12:12
MergeSort in Scala with recursive merge
object MergeSort {
// recursive merge of 2 sorted lists
def merge(left: List[Int], right: List[Int]): List[Int] =
(left, right) match {
case(left, Nil) => left
case(Nil, right) => right
case(leftHead :: leftTail, rightHead :: rightTail) =>
if (leftHead < rightHead) leftHead::merge(leftTail, right)
else rightHead :: merge(left, rightTail)
@fancellu
fancellu / ConsumerExample.scala
Last active November 28, 2024 13:00
Kafka Producer/Consumer Example in Scala
import java.util
import org.apache.kafka.clients.consumer.KafkaConsumer
import scala.collection.JavaConverters._
object ConsumerExample extends App {
import java.util.Properties
@ErunamoJAZZ
ErunamoJAZZ / JsValueDeserializer.scala
Last active June 9, 2023 12:06
play-json JsValue, Kafka Serializer and Deserializer
import org.apache.kafka.common.serialization.Deserializer
import play.api.libs.json.Json
class JsValueDeserializer extends Deserializer[JsValue] {
private val encoding = "UTF8"
override def configure(configs: util.Map[String, _], isKey: Boolean): Unit = {
// nothing to do
}
@marians
marians / Chromium Linux.md
Last active May 19, 2024 09:03
How to install CA certificates and PKCS12 key bundles on different platforms

We install certutil and pk12util if necessary:

sudo apt install libnss3-tools

On Linux, Chromium uses the NSS Shared DB. Check if you have the ~/.pki/nssdb directory:

ls $HOME/.pki/nssdb
@fancellu
fancellu / TryFlatten.scala
Created April 11, 2017 00:44
A few ways to flatten down a Seq[Try] to only Success values
import scala.util.{Success, Failure}
val seq=Seq(Success(1), Failure(new Exception("bang")), Success(2))
// all emit List(1, 2)
seq.map(_.toOption).flatten
seq.flatMap(_.toOption)
seq.filter(_.isSuccess).map(_.get)
seq.collect{case Success(x) => x}
@LinusCDE
LinusCDE / README.md
Last active January 4, 2018 16:28
AdventOfCode 2017 day 7 part 2: Visualisation of the problem

It outputs a json-style tree of all towers/programs that are not balanced.

You need to get the value of the last tower that is unbalanced, but has no unbalanced sub-towers.

To get a good visualization do the following:

Using the input in the repo you'll get this output:

@ryansimms
ryansimms / circleci-2.0-eb-deployment.md
Last active February 22, 2024 04:55
Deploying to Elastic Beanstalk via CircleCi 2.0

Deploying to Elastic Beanstalk via CircleCi 2.0

I got to here after spending hours trying to deploy to an Elastic Beanstalk instance via CircleCi 2.0 so I thought I'd write up what worked for me to hopefully help others. Shout out to RobertoSchneiders who's steps for getting it to work with CircleCi 1.0 were my starting point.

For the record, I'm not the most server-savvy of developers so there may be a better way of doing this.

Setup a user on AWS IAM to use for deployments

@travisbrown
travisbrown / response-de-goes.md
Last active March 31, 2024 14:41
Response to cease and desist letter from John A. De Goes, CEO of Ziverge