Skip to content

Instantly share code, notes, and snippets.

View tovbinm's full-sized avatar
⌨️
<typing sounds>

Matthew Tovbin tovbinm

⌨️
<typing sounds>
View GitHub Profile
@mmalek-sa
mmalek-sa / yum-cron.md
Last active July 13, 2023 08:56
How to enable yum-cron on Amazon Linux 2, CentOS and RHEL servers to automatically install updates

Automatic updates with yum-cron

If you are on RHEL make sure optional repos are enabled:

subscription-manager repos --enable rhel-7-server-optional-rpms

Then install yum-cron:

@cb372
cb372 / jargon.md
Last active May 8, 2023 16:03
Category theory jargon cheat sheet

Category theory jargon cheat sheet

A primer/refresher on the category theory concepts that most commonly crop up in conversations about Scala or FP. (Because it's embarassing when I forget this stuff!)

I'll be assuming Scalaz imports in code samples, and some of the code may be pseudo-Scala.

Functor

A functor is something that supports map.

@jmruc
jmruc / README.md
Created June 24, 2013 19:19
Generating pom.xml from gradle

To generate a pom.xml file just run gradle writeNewPom

If you want to generate it as pom.xml in the root of the project, replace writeTo("$buildDir/newpom.xml") with writeTo("pom.xml")

@tlrobinson
tlrobinson / gist:1073865
Created July 9, 2011 19:34
Autocomplete Makefile targets. Add this to your shell config file.
complete -W "\`grep -oE '^[a-zA-Z0-9_-]+:([^=]|$)' Makefile | sed 's/[^a-zA-Z0-9_-]*$//'\`" make
@tovbinm
tovbinm / fauna-graphql-relations.gql
Last active March 6, 2022 14:38
FaunaDB Relations: GraphQL schemas, mutations and resulting documents
****************************************************************************
**** FaunaDB Relations: GraphQL schemas, mutations and resulting documents *
****************************************************************************
**** One to One Relation ***************************************************
SCHEMA:
type User { name: String! car: Car }
type Car { plate: String! owner: User }
MUTATION:
mutation Create {
createUser(data: {
@mletterle
mletterle / gist:8048086
Last active November 26, 2021 08:56
Replay Two Git Repositories History Into A New One, Chronologically

Combining Two (or more potentially) Git Repos

###Moving one repo into a subdirectory of the other

Preserves notes and sets commit details to author details

in newrepo

apply plugin: 'application'
apply plugin: 'scala'
repositories {
mavenLocal()
mavenCentral()
}
mainClassName = 'PushkaTest.MainApp'
@pchiusano
pchiusano / microbenchmark.markdown
Created December 2, 2011 13:49
Simple microbenchmarks comparing Scala vs Java mutable map performance

I was curious about the results reported here, which reports that Scala's mutable maps are slower than Java's: http://www.infoq.com/news/2011/11/yammer-scala

In my tests, Scala's OpenHashMap equals or beats java's HashMap:

Insertion 100k elements (String keys) time in ms:

  • scala HashMap: 92.75
  • scala OpenHashMap: 14.03125
  • java HashMap: 15.78125
@julianpeeters
julianpeeters / spark-avro-reading-noIDL
Last active February 8, 2021 17:05
read avros in spark without an IDL with GenericRecord
//Adapted from: https://github.com/jcrobak/avro-examples
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._
import org.apache.avro.generic.GenericRecord
import org.apache.avro.mapred.AvroKey
import org.apache.avro.mapreduce.AvroKeyInputFormat
import org.apache.hadoop.io.NullWritable
import org.apache.commons.lang.StringEscapeUtils.escapeCsv
@calippo
calippo / Mappable.scala
Created July 27, 2016 21:51
Convert case class to map in shapeless
object Mappable {
implicit class ToMapOps[A](val a: A) extends AnyVal {
import shapeless._
import ops.record._
def toMap[L <: HList](implicit
gen: LabelledGeneric.Aux[A, L],
tmr: ToMap[L]
): Map[String, Any] = {
val m: Map[tmr.Key, tmr.Value] = tmr(gen.to(a))