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
def maior_primo(n): | |
cont = 1 | |
maior = 0 | |
while cont <= n: | |
if primo(cont): | |
if cont > maior: | |
maior = cont | |
cont += 1 | |
return maior |
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
def main(): | |
print("Bem-vindo ao jogo do NIM! Escolha:") | |
print("1 - para jogar uma partida isolada") | |
print("2 - para jogar um campeonato") | |
o = input() | |
if o == "1": | |
print("Você escolheu partida isolada!") | |
partida() | |
elif o == "2": |
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 re | |
def le_assinatura(): | |
'''A funcao le os valores dos tracos linguisticos do modelo e devolve uma assinatura a ser comparada com os textos fornecidos''' | |
print("Bem-vindo ao detector automático de COH-PIAH.") | |
wal = float(input("Entre o tamanho medio de palavra:")) | |
ttr = float(input("Entre a relação Type-Token:")) | |
hlr = float(input("Entre a Razão Hapax Legomana:")) | |
sal = float(input("Entre o tamanho médio de sentença:")) |
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" | |
"strconv" | |
"strings" | |
) | |
func main() { | |
x := generateMessage("Hello {0}, you have {1} new messages!", "Gerep", "12") |
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
prefix=/opt/oracle/instantclient | |
libdir=${prefix} | |
includedir=${prefix}/sdk/include/ | |
Name: OCI | |
Description: Oracle database engine | |
Version: 11.2 | |
Libs: -L${libdir} -lclntsh | |
Libs.private: | |
Cflags: -I${includedir} |
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
=IF(LEN(A1) < 11,CONCAT(REPT(0,11 - LEN(A1)), A1),A1) | |
=IF(LEN(A1) < 11, | |
CONCAT( | |
REPT(0,11 - LEN(A1) | |
), | |
A1), | |
A1) |
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
-- show running queries (pre 9.2) | |
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(query_start, clock_timestamp()), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
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
func spinner(delay time.Duration) { | |
for { | |
for _, r := range `-\|/` { | |
fmt.Printf("\r%c", r) | |
time.Sleep(delay) | |
} | |
} | |
} |
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
// Execution example: TZ=US/Eastern ./clock2 --port 8000 | |
package main | |
import ( | |
"flag" | |
"io" | |
"log" | |
"net" | |
"os" |
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 ( | |
"context" | |
"log" | |
"sync" | |
"time" | |
) | |
var wg sync.WaitGroup |