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
(ns p16 | |
(:require [clojure.string :as str])) | |
(defn to-int[s] | |
(if (re-matches #"\d+" s) | |
(Integer/parseInt s) | |
s)) | |
(defn parse-rule[rule] | |
(->> rule |
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 main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"log" | |
"reflect" | |
"strings" | |
) |
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
curl "$github/search/repositories?q=java%20rocks" | jq '.items[].url' | shuf -n1 |
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
SPRING_LOG_FILE=/tmp/spring_alura.log | |
rm $SPRING_LOG_FILE | |
docker stop alura | |
docker run --rm --name alura -e MYSQL_ROOT_PASSWORD=123 -p3306:3306 -d mysql:5.6 | |
sleep 1 | |
while ! docker logs alura 2>&1 | grep 'ready for connections'; do | |
sleep 1 | |
echo Esperando mysql subir no container Docker... |
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 algo; | |
import java.math.BigInteger; | |
import java.util.Arrays; | |
import java.util.Random; | |
public class Matrix { | |
private int rows; | |
private int columns; |
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
CREATE TABLE Autores ( | |
codigo int not null, | |
nome varchar(255), | |
nacionalidade varchar(255), | |
PRIMARY KEY (codigo) | |
); | |
CREATE TABLE Saloes ( | |
numero int not null, | |
andar int, |
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
#!/usr/bin/tclsh | |
# Read a configuration file | |
# http://rosettacode.org/wiki/Read_a_configuration_file | |
# Qui Mar 6 20:37:26 BRT 2014 | |
# parameters to load | |
set fullname "" | |
set favouritefruit "" | |
set needspeeling no | |
set seedsremoved no |
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
for {set i 3} {$i < 1000} {inc i} {if {$i % 3 == 0 || $i % 5 == 0} {set total [expr {$total + $i}]}} |
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
IDENTIFICATION DIVISION. | |
PROGRAM-ID. EULERPROB1. | |
ENVIRONMENT DIVISION. | |
DATA DIVISION. | |
WORKING-STORAGE SECTION. | |
01 COUNTER PIC 9999 VALUE 1. | |
01 TOTAL PIC 9(6) VALUE 0. | |
01 REST PIC 999. | |
88 DIVISIBLE VALUE ZERO. |
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
# Markov Chain Algorithm (The Practice of Programming pg 62) | |
# set w1 and w2 to be the first two words in the text | |
# print w1 and w2 | |
# loop: | |
# randomly choose w3, one of successors of prefix w1 and w2 | |
# print w3 | |
# replace w1 and w2 by w2 and w3 | |
# repeat loop | |
import random |
NewerOlder