Skip to content

Instantly share code, notes, and snippets.

View mauricio's full-sized avatar

Maurício Linhares mauricio

View GitHub Profile
@mauricio
mauricio / fib.rb
Last active August 29, 2015 14:13
def fib( n )
return n if ( 0..1 ).include? n
( fib( n - 1 ) + fib( n - 2 ) )
end
threads = []
4.times do
threads << Thread.new do
fib(50) while true
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@mauricio
mauricio / titanic.csv
Last active August 29, 2015 14:10
Titanic data from Kaggle competition
PassengerId Survived PassengerClass Name Sex Age SpouseSiblingsAboard ParentsChildrenAboard Ticket Fare Cabin Embarked
1 0 3 Braund, Mr. Owen Harris male 22 1 0 A/5 21171 7.25 S
2 1 1 Cumings, Mrs. John Bradley (Florence Briggs Thayer) female 38 1 0 PC 17599 71.2833 C85 C
3 1 3 Heikkinen, Miss. Laina female 26 0 0 STON/O2. 3101282 7.925 S
4 1 1 Futrelle, Mrs. Jacques Heath (Lily May Peel) female 35 1 0 113803 53.1 C123 S
5 0 3 Allen, Mr. William Henry male 35 0 0 373450 8.05 S
6 0 3 Moran, Mr. James male 0 0 330877 8.4583 Q
7 0 1 McCarthy, Mr. Timothy J male 54 0 0 17463 51.8625 E46 S
8 0 3 Palsson, Master. Gosta Leonard male 2 3 1 349909 21.075 S
9 1 3 Johnson, Mrs. Oscar W (Elisabeth Vilhelmina Berg) female 27 0 2 347742 11.1333 S
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Configuration for API queues, security groups and other general configuration",
"Resources": {
"ApiSecurityGroupProduction": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "Group for the api instances",
"GroupName": "api_production",
"SecurityGroupIngress": [
import sbt._
import Keys._
object ProjectBuild extends Build {
val commonName = "db-async-common"
val postgresqlName = "postgresql-async"
val mysqlName = "mysql-async"
lazy val root = Project(
@mauricio
mauricio / eleicoes.csv
Created April 27, 2014 14:49
eleições
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
"25/04/2014";"22:29:30";"2012";"1";"ELEIÇÃO MUNICIPAL 2012";"PB";"19798";"19798";"CAMALAÚ";"29";"11";"PREFEITO";"4929";"16";"0";"4929";"16";"4175";"754";"2995";"562";"618";"0";"0";"07/10/2012";"18:16:58"
"25/04/2014";"22:29:30";"2012";"1";"ELEIÇÃO MUNICIPAL 2012";"PB";"20419";"20419";"ITAPORANGA";"33";"13";"VEREADOR";"17157";"51";"0";"17157";"51";"13919";"3238";"12408";"191";"345";"975";"0";"07/10/2012";"18:01:19"
"25/04/2014";"22:29:30";"2012";"1";"ELEIÇÃO MUNICIPAL 2012";"PB";"20770";"20770";"MALTA";"51";"11";"PREFEITO";"4677";"15";"0";"4677";"15";"4087";"590";"3889";"38";"160";"0";"0";"07/10/2012";"17:30:26"
"25/04/2014";"22:29:30";"2012";"1";"ELEIÇÃO MUNICIPAL 2012";"PB";"21091";"21091";"OLHO D'ÁGUA";"32";"13";"VEREADOR";"6653";"25";"0";"6653";"25";"5538";"1115";"4894";"65";"228";"351";"0";"07/10/2012";"18:17:00"
"25/04/2014";"22:29:30";"2012";"1";"ELEIÇÃO MUNICIPAL 2012";"PB";"21113";"21113";"OLIVEDOS";"23";"13";"VEREADOR";"3243";"11";"0";"3243";"11";"3038";"205";"2766";"26";"83";"163";"0";"07/10/2012";"
segment = ARGV[0]
taxa = "reference_HAs.fasta"
fasta = "2009pdm_extracts.fasta"
search = IO.read( taxa ).split('>').inject({}) do |accumulator,line|
sorting = line.strip.split("\n")
name = sorting.shift
accumulator[name.split("|")[1]] = 0
accumulator
end
import Keys._
name := "hello"
version := "1.0"
scalaVersion := "2.10.2"
lazy val hello = taskKey[Unit]("A custom run task.")
#lang racket
(define (sum xs)
(cond
[(null? xs) 0]
[(number? xs) xs]
[(list? xs) (+ (sum (car xs)) (sum (cdr xs))) ]
[#t 0]
))
exception AssertionFailure of string;
fun assert_true( result : bool, message : string ) =
if result
then result
else raise AssertionFailure message
fun assert_false( result : bool, message : string ) =
if result
then raise AssertionFailure message