Skip to content

Instantly share code, notes, and snippets.

View idarlington's full-sized avatar

Ikenna Ogbajie idarlington

View GitHub Profile
@idarlington
idarlington / TicTacToe.scala
Created September 14, 2021 14:04
TicTacToe in Scala
package tictactoe
import scala.annotation.tailrec
// model
trait Square
case object X extends Square {
override def toString: String = "X"
}
object CracklePop {
def main(args: Array[String]): Unit = {
(1 to 100).collect {
case number if (number % 5 == 0) && (number % 3 == 0) => println("CracklePop")
case number if number % 5 == 0 => println("Pop")
case number if number % 3 == 0 => println("Crackle")
case number => println(number)
}
}
}
/**
* [WIP]
*
* The goal is to recursively convert a genericRecord to have lower case field names.
*/
import org.apache.avro.{Schema, SchemaBuilder}
import scala.collection.JavaConverters._
@idarlington
idarlington / Intersection.scala
Last active August 28, 2019 08:44
Scala list intersection
def intersect(first: List[Int], second: List[Int]): Seq[Int] = {
val result = for {
i <- first
j <- second
if i == j
} yield i
result.toSet.toSeq
}
@idarlington
idarlington / Connection.groovy
Last active July 5, 2018 12:04
create a groovy connection
class Connection {
String urlPath
private String username = project.properties.username
private String password = project.properties.password
private String basicAuth = "$username:$password".bytes.encodeBase64().toString()
URL url = urlPath.toURL();
InputStream getStream() {
URLConnection connection = url.openConnection();
@idarlington
idarlington / installing_cassandra.md
Last active February 4, 2018 04:46 — forked from hkhamm/installing_cassandra.md
Installing Cassandra on Mac OS X

Installing Cassandra on Mac OS X

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@idarlington
idarlington / gist:bbc469f799de6a9d891d42052883a89a
Created July 20, 2017 11:18
custom logrotate conf for pi
/var/log/transmit.log {
su root pi
copytruncate
compress
daily
rotate 7
missingok
notifempty
}
@idarlington
idarlington / zipLogs.sh
Created June 9, 2017 09:15
zip files older than n days
find . -mtime +n -print -exec gzip {} \;
@idarlington
idarlington / gitconfig.ini
Created April 28, 2017 07:49 — forked from tdd/gitconfig.ini
Nice, useful global Git configuration
# Put this in your ~/.gitconfig or ~/.config/git/config
# Windows users: "~" is your profile's home directory, e.g. C:\Users\<YourName>
[user]
name = Your Full Name
email = your@email.tld
[color]
# Enable colors in color-supporting terminals
ui = auto
[alias]
st = status
@idarlington
idarlington / .md
Last active February 24, 2017 22:12
Setting Up Scala

Installing Java

You can either install Oracle Java or OpenJDK (the Open Source implementation of Oracle Java)

Installing Oracle Java

Ubuntu

sudo apt-get install python-software-properties