Skip to content

Instantly share code, notes, and snippets.

Avatar

iury IuryAlves

View GitHub Profile
View Fatorial.java
public class Fatorial {
public int fatorial(int num) throws InvalidNumberException {
if (num < 0)
return 0;
if (num <= 1) {
return 1;
} else {
View example.js
var datas;
db.transaction(function(transaction){
transaction.executeSql('SELECT * FROM Comics WHERE name = ? ',
[["batman"]],
function(transaction,result){
for(var i = 0; i < result.rows.length;i++){
datas = result.rows.item(i)['name'];
}
},
View criptografia.cpp
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
string nome("Texto #3");
string nova = "";
int i,aux,n,m;
cin >> n;
View leds.cpp
#include <iostream>
#include <map>
#include <utility>
using namespace std;
/* dado usa sequencia de caracteres numericos imprime quantos leds serão preciso para mostrar os caracteres
é utilizado a entrada e saída padrão
*/
View simpleListRandom.py
import random
lista = random.sample(xrange(1,61), 50)
lista2 = random.sample(xrange(1,61), 50)
lista = lista + lista2
View json_example.py
#coding: utf-8
import json
with open('urls.json', 'r') as urls:
dic = json.load(urls, encoding='utf-8')
for item in dic['responseData']:
sub_item = dic['responseData']['results']
for s in sub_item:
View mictorios.py
# coding: utf-8
"""
Participantes:
Zorak, Iury, Lucas Rogério, Willian, Lucas Campos, Bruno Henrique, Elias, Rafael, Bustalover, Jhonny, Plinio
"""
import unittest
View mpi_example.c
#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
void print(int vector[], int process, int size){
// imprime todos os numeros no vetor
int i;
printf("processo: %d \n", process);
for(i = 0; i < size ; i++){
View mpi_largest_sum.c
#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
/*
Pra compilar execute mpicc mpi_largest_sum.c -o mpi_largest_sum
Pra rodar execute mpirun -n 4 mpi_largest_sum
o parametro -n indica a quantidade de processadores, voce pode aumentar ou diminuir = )
*/
View gist:82ad68f804fbb0daa015
sudo apt-get install postfix
sudo apt-get install mailutils
sudo nano /etc/postfix/main.cf
sudo service postfix restart
mail -s "subject" usuario@dominio.com < mensagem.txt
# See /usr/share/postfix/main.cf.dist for a commented, more complete version