Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import print_function, absolute_import, unicode_literals, division
with open ("input.txt") as f:
xs = f.read().strip().split("\n")
vals = [int(x) for x in xs]
vals |> sum |> print

Keybase proof

I hereby claim:

  • I am mfirry on github.
  • I am mfirry (https://keybase.io/mfirry) on keybase.
  • I have a public key whose fingerprint is 139A FAEB 86CD E9C0 E126 68E3 CDFE 8735 DB12 85EA

To claim this, I am signing this object:

export OPENSSL_INCLUDE_DIR=`brew --prefix openssl`/include
export OPENSSL_LIB_DIR=`brew --prefix openssl`/lib
@mfirry
mfirry / BigDecimalGroup.scala
Created October 19, 2016 09:59
cats-like implementation of CommutativeGroup for BigDecimal
class BigDecimalGroup extends CommutativeGroup[BigDecimal] {
def combine(x: BigDecimal, y: BigDecimal): BigDecimal = x + y
def empty: BigDecimal = 0
def inverse(x: BigDecimal): BigDecimal = -x
override def remove(x: BigDecimal, y: BigDecimal): BigDecimal = x - y
}
implicit val catsKernelStdGroupForBigDecimal: CommutativeGroup[BigDecimal] = new BigDecimalGroup
@mfirry
mfirry / database.js
Created September 7, 2015 13:11
first-steps-with-relay-graphql
export class Ticket extends Object {}
var tickets = [];
(function() {
var t1 = new Ticket();
t1.id = '1';
t1.from = 'CTA';
t1.via = 'FCO';
t1.to = 'JFK';
t1.airports = ['CTA', 'FCO', 'JFK'];
@mfirry
mfirry / MySchema.js
Created September 7, 2015 08:41
Foolin' around with GraphQL
import {
graphql,
GraphQLSchema,
GraphQLObjectType,
GraphQLString,
GraphQLEnumType,
GraphQLInterfaceType,
GraphQLList,
GraphQLNonNull,
GraphQLInt
@mfirry
mfirry / core.clj
Created September 4, 2015 07:48
Basic :require in Clojure
(ns test123.core
(:require [test123.limo :as l]))
(defn -main [] (l/foo "Marco"))

Keybase proof

I hereby claim:

  • I am mfirry on github.
  • I am mfirry (https://keybase.io/mfirry) on keybase.
  • I have a public key whose fingerprint is 4622 0E9C F178 AD98 3037 41CA DAEE B33F 8538 91C9

To claim this, I am signing this object:

@mfirry
mfirry / marinetti
Created April 27, 2015 17:13
DO NOT DO IT! silly example of handling to/fro Twitter Utils' Future to Scala Futures (using https://github.com/twitter/bijection)
import com.twitter.bijection.twitter_util.UtilBijections._
import com.twitter.bijection.{ AbstractBijection, Bijection, ImplicitBijection }
import com.twitter.util.Future
import scala.concurrent._
import scala.concurrent.ExecutionContext.Implicits.global
//let's create two futures and put them in a List
val a = com.twitter.util.Future(1)