This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Test cla |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package aux | |
object Scaladores extends App { | |
implicit class AddOf(val num : Int) extends AnyVal { | |
def of[T <: MeasureUnit] = Value[T](num) | |
} | |
trait MeasureUnit | |
trait x[A <: MeasureUnit, B <: MeasureUnit] extends MeasureUnit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package aux | |
class BuilderTypeSafe { | |
type Sim | |
type Nao | |
class Pessoa | |
class Builder[TemNome, TemEndereco] { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PS1="\[\033[38m\]\u@\h\[\033[32m\] \w \[\033[31m\]\`git branch 2>/dev/null | grep \"^\*\" | sed -r \"s/\*\ (.*)/\(\1\)/\"\` \`git status --porcelain 2>/dev/null | tee >(grep -c \"^[A-Z] \") | tee >(grep -c \"^ [A-Z]\") | tee >(grep -c \"^??\") | tee >(grep -c \"^[A-Z][A-Z]\") | grep \"^[0-9]\" | tr \"\n\" \" \" | grep -v \"0 0 0 0 \"\`\[\033[37m\]$\[\033[00m\] " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Map; | |
public class InferenciaDeTiposEmJava { | |
// Inferência meia boca | |
List<Map<String, Integer>> a = new ArrayList<>(); | |
public static void main(final String[] args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
TABELAS=`find . -path ./TABELAS_SUS -prune -o -iname *.dbf | cut -d "/" -f 4 | sed -r 's/([a-zA-Z]+)[a-zA-Z]{2}.*/\1/' | tr '[A-Z]' '[a-z]' | sort | uniq` | |
for X in $TABELAS; do | |
ARQUIVO=`find . -path ./TABELAS_SUS -prune -o -iname "$X*.dbf" | grep -i dbf | tail -n 1` | |
echo "gerando tabela $X usando $ARQUIVO" | |
dbf2mysql -d datasus -t $X -cc -U root $ARQUIVO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Não. Você produz apenas uma matriz. (https://en.wikipedia.org/wiki/Matrix_multiplication#Illustration ) | |
Se a multiplicação é AxB=C (A, B e C são matrizes), cada resultado da matriz C é produzido pela multiplicação de uma linha de A com uma coluna de B. | |
[1, 2] [5, 6] [1*5+2*7, 1*6+2*8] [19, 22] | |
[3, 4] X [7, 8] = [3*5+4*7, 3*6+4*8] = [43, 50] | |
O que você consegue fazer é fazer cada runnable pegar um número de linhas, nesse caso, 1: | |
Runnable1: [1, 2] [5, 6] [19, 0] | |
X [7, 8] = [43, 0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
rm -f controle | |
for ESTADO in `ls`; do | |
for ARQUIVO in `ls $ESTADO`; do | |
EXT=$(echo $ARQUIVO | cut -d "." -f 2) | |
DESTDIR="/home/ubuntu/dbf/$ESTADO/$ARQUIVO" | |
FILE="$ESTADO/$ARQUIVO" | |
mkdir -p $DESTDIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Certo... -1 nao compila. Precisa ser - 1 | |
# J => 10, Q => 11, K => 12, A => 13 | |
class Resultado | |
attr_reader :v, :n | |
def initialize(n, v) | |
@v = v | |
@n = n | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Meo deus! esse require abaixo abre Array e acrescenta o método to_set !!! | |
require 'set' # Sim. Um set. Precisa de acesso O(1) | |
class Robo | |
def initialize(terreno, posicao, direcao) | |
@terreno = terreno | |
@posicao = posicao | |
@direcao = direcao | |
@andar = { :norte => [0, 1], |
NewerOlder