Skip to content

Instantly share code, notes, and snippets.

View mcrisc's full-sized avatar

Marcelo Criscuolo mcrisc

View GitHub Profile
# Superman March, by John Williams, played by a Raspberry Pi Pico
# Tutorial: Using buzzers with Raspberry Pi Pico - https://projects.raspberrypi.org/en/projects/introduction-to-the-pico/9
# Music Scores: https://musicum.net/superman.pdf
# Video: https://youtu.be/u6veDQYzYYk
import time
from picozero import Speaker
BPM = 76
BEAT = 60.0 / BPM
codes = {
61: 'Brasilia',
71: 'Salvador',
11: 'Sao Paulo',
21: 'Rio de Janeiro',
32: 'Juiz de Fora',
19: 'Campinas',
27: 'Vitoria',
31: 'Belo Horizonte'
}
@mcrisc
mcrisc / MyApp.java
Created December 3, 2021 17:08
Exemplo de CardLayout
package example;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.util.Set;
import javax.swing.JButton;
@mcrisc
mcrisc / criacao-usuario-mysql.md
Created November 25, 2020 19:22
DSIS4 2020-2: criação de usuário no MySQL
  1. Conecte-se ao MySQL com o usuário root.

  2. Crie um usuário chamado 'dsi', por meio do comando:

    CREATE USER 'dsi'@'localhost' IDENTIFIED BY 'banana';

    Nesse caso, a senha do usuário dsi será banana.

@mcrisc
mcrisc / ExemploExcecao.java
Last active September 30, 2020 13:11
Exemplos de tratamento de exceções
import java.util.Scanner;
public class ExemploExcecao {
public static void main(String[] args) {
double[] precos = new double[] {3.95, 1.30, 2.80};
System.out.println("Cotação de Preços");
System.out.print("Fornecedor: ");
Scanner sc = new Scanner(System.in);
@mcrisc
mcrisc / codigos.py
Created May 28, 2020 14:28
Elfos e seus códigos (URI #2020)
# Elfos e seus códigos
# https://www.urionlinejudge.com.br/judge/pt/problems/view/2020
import string
UPPERCASE_LETTERS = string.ascii_letters[26:]
list_num = 0
while True:
@mcrisc
mcrisc / sorteio.py
Created April 1, 2019 14:31
Sorteio entre as equipes da Maratona IFSP 2019-1
import random
import time
equipes = [
'@7L4$',
'#include<maratona.h>',
'A Pena do Ponteiro Solto',
'Reapers',
'Grupo Ah Moleque',
'Anonymous',
@mcrisc
mcrisc / remove-apps.sh
Created May 9, 2018 13:49
Uninstall Android applications via ADB
#!/bin/bash
ADB="$ANDROID_HOME/platform-tools/adb"
if [ -z "$1" ]; then
echo "usage: $0 <filter> [rm]"
exit 1
fi
import argparse
def main():
parser = argparse.ArgumentParser(
description='Compute precision at k.')
parser.add_argument(
'-k', help='k, to compute precision@k', type=int, default=1)
parser.add_argument('qrels', help='TREC relevance file (qrels)')
parser.add_argument('topfile', help='TREC results file')
def mycosine(v1, v2):
"""
Calcular o cosseno do ângulo theta, formado pelos vetores v1 e v2.
"""
raise NotImplementedError
# -- BEGIN: não alterar --
try: