Skip to content

Instantly share code, notes, and snippets.

@santiagosilas
santiagosilas / Numpy-Simple.py
Created August 24, 2020 10:40
Numpy Simple
import numpy as np
# Definindo Arrays
a = np.array([1., .5, 2.5])
a = np.array([1., .5, 2.5], dtype = float)
m = np.array([[1,2,3], [4,5,6], [7,8,9],[7,8,9],[7,8,9],[7,8,9],[7,8,9]])
a.shape #dimensões do array
@santiagosilas
santiagosilas / RunningMySQLOnVMDigitalOcean.py
Created September 9, 2019 11:20
Running MySQL on VM Digital Ocean
# pip install flask
# pip instal flask-sqlalchemy
# sudo apt-get install libpq-dev
# sudo pip install psycopg2
# sudo pip install redshift-sqlalchemy
# sudo pip install sqlparse
# sudo pip install mysqlclient
import multiprocessing
import time
class Monitor(multiprocessing.Process):
def __init__(self, ):
multiprocessing.Process.__init__(self)
self.exit = multiprocessing.Event()
@santiagosilas
santiagosilas / Exemplo.c
Created May 21, 2019 22:35
Exercício de Fixação
#include<stdio.h>
int main(){
int entrada, horas, minutos, segundos, resto;
printf("entrada em segundos:");
scanf("%d", &entrada);
horas = entrada / 3600;
resto = entrada % 3600;
minutos = resto / 60;
segundos = resto % 60;
@santiagosilas
santiagosilas / AnsiCAlocacaoDinamicaMatrizesFuncoes.c
Created April 7, 2019 21:37
ANSI C - Alocação Dinâmica de Matrizes - Exemplo com Funções
#include <stdio.h>
#include<stdlib.h>
#include<time.h>
int **CriarMatriz(int L, int C){
// Aloca as linhas da matriz
int **m = calloc(L, sizeof(int *));
// Aloca as colunas da matriz
int i, j;
@santiagosilas
santiagosilas / main.c
Created April 7, 2019 21:25
ANSI C - Alocação Dinâmica de Matriz
#include <stdio.h>
#include<stdlib.h>
#include<time.h>
int main(void) {
// Alocação Dinâmica e Inicialização de uma Matriz
@santiagosilas
santiagosilas / main.c
Created April 7, 2019 21:24
LowTallExpertise created by santiagosilas - https://repl.it/@santiagosilas/LowTallExpertise
#include <stdio.h>
#include<stdlib.h>
#include<time.h>
int main(void) {
// Alocação Dinâmica e Inicialização de uma Matriz
@santiagosilas
santiagosilas / main.c
Created April 7, 2019 21:08
ANSI C - Alocação Dinâmica de Vetor
#include <stdio.h>
#include<stdlib.h>
#include<time.h>
int *CriarVetor(int n){
int i;
// Cria um vetor dinamicamente alocado
int *v = malloc(n * sizeof(int));
// Inicializa o vetor
@santiagosilas
santiagosilas / main.c
Last active April 7, 2019 20:54
ANSI C - CALLOC
/**
Exemplifica o uso de sizeof em C */
#include <stdio.h>
#include<stdlib.h>
int main(void) {
// Uma variável declarada dinamicamente
int *x = calloc(1, sizeof(int));
// Se ocorrer erro ao alocar
@santiagosilas
santiagosilas / main.c
Created April 7, 2019 20:51
ANSI C - malloc
/**
Exemplifica o uso de sizeof em C */
#include <stdio.h>
#include<stdlib.h>
int main(void) {
// Uma variável declarada dinamicamente
int *x = malloc(1 * sizeof(int));
// Se ocorrer erro ao alocar