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
// Split the integer number into two (n is always even in size) | |
// Sum each half, if they are equal, return true | |
package main | |
import ( | |
"fmt" | |
"strconv" | |
) |
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 |
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
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
-- 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
=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
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
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
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
def maior_primo(n): | |
cont = 1 | |
maior = 0 | |
while cont <= n: | |
if primo(cont): | |
if cont > maior: | |
maior = cont | |
cont += 1 | |
return maior |