Skip to content

Instantly share code, notes, and snippets.

View clock2.go
// Execution example: TZ=US/Eastern ./clock2 --port 8000
package main
import (
gerep / spinner.go
Created Nov 18, 2017
Loading animation for terminal
View spinner.go
func spinner(delay time.Duration) {
for {
for _, r := range `-\|/` {
fmt.Printf("\r%c", r)
View postgres_queries_and_commands.sql
-- 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%'
gerep / append-zeroes.txt
Created Nov 14, 2017
Append zeroes to CPF numbers with < 11 characters on LibreOffice
View append-zeroes.txt
=IF(LEN(A1) < 11,CONCAT(REPT(0,11 - LEN(A1)), A1),A1)
=IF(LEN(A1) < 11,
REPT(0,11 - LEN(A1)
gerep / oci8.pc
Created Nov 9, 2017
View oci8.pc
Name: OCI
Description: Oracle database engine
Version: 11.2
Libs: -L${libdir} -lclntsh
Cflags: -I${includedir}
View placeholder.go
package main
import (
func main() {
x := generateMessage("Hello {0}, you have {1} new messages!", "Gerep", "12")
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:"))
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!")
elif o == "2":
def maior_primo(n):
cont = 1
maior = 0
while cont <= n:
if primo(cont):
if cont > maior:
maior = cont
cont += 1
return maior
gerep / pg-dates.sql
Created Aug 22, 2017
PostgreSQL: yesterday, today, tomorrow
View pg-dates.sql
select TIMESTAMP 'yesterday';
select DATE 'yesterday';
select TIMESTAMP 'today';
select DATE 'today';
select TIMESTAMP 'tomorrow';
select DATE 'tomorrow';
select TIME 'allballs';
select now();
select TIMESTAMP 'now';
select DATE 'now';