Skip to content

Instantly share code, notes, and snippets.

View yudi-matsuzake's full-sized avatar

Yudi Matsuzake yudi-matsuzake

  • Curitiba, Paraná, Brasil
View GitHub Profile
@yudi-matsuzake
yudi-matsuzake / certugol.h
Created January 20, 2016 12:39
Brincando com o macroprocessador do c
#ifndef _CERTUGOL_H_
#define _CERTUGOL_H_
#define se if
#define paratodo for
#define enquanto ;
#define principal main
#define vazio void
#define retorne return
#define inteiro int
@yudi-matsuzake
yudi-matsuzake / mutual_exclusion.c
Last active December 31, 2015 05:30
Example of mutual exclusion problem in POSIX threads
// Mutual Exclusion Example
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define NUM_THREADS 500
#define N_SUM 100000
void* sum(void *t)
{
#include <iostream>
typedef struct _{
_& operator()(void){
static int n = 0;
std::cout << n << std::endl;
n++;
return *this;
}
}_;
#include <stdio.h>
int main(){
unsigned long long int n[38];
n[0] = 0xa330a320a310a30;
n[1] = 0xa370a360a350a34;
n[2] = 0x310a30310a390a38;
n[3] = 0xa33310a32310a31;
@yudi-matsuzake
yudi-matsuzake / rapid.cpp
Created November 27, 2015 10:20
Pequeno exemplo da utilização do RapidXML
#include <iostream>
#include <fstream>
#include <sstream>
#include <rapidxml/rapidxml.hpp>
#include <rapidxml/rapidxml_utils.hpp>
void bufferize(char* file_name, char*& buffer, size_t& size){
//tamanho
FILE* file = fopen(file_name, "r");
fseek(file, 0L, SEEK_END);
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
using namespace cv;
#define WINDOW_TITLE "Modular Fractal"
#define IMG_WSIZE 750
#define IMG_HSIZE 750
@yudi-matsuzake
yudi-matsuzake / naive-hash.c
Created November 4, 2015 01:33
Hash bobo do exercicício 4 da aula-21
#include <stdio.h>
#define BUFFER_SIZE 4098
#define ERROR_MSG "Não pôde abrir o arquivo %s.\n"
#define USAGE_MSG "USAGE: %s <file> [file ...]\n"
unsigned char naive_hash(char* filename){
FILE* file = fopen(filename, "r");
if(!file){
@yudi-matsuzake
yudi-matsuzake / afim.c
Created October 22, 2015 21:56
cifra afim
#include <stdio.h>
#include <string.h>
#define USAGE "USAGE: %s <cifra|decifra> [arquivo_entrada.txt]\n"
#define BUFFER_SIZE 2048
#define CMD_CIFRA "cifra"
#define CMD_DECIFRA "decifra"
#define N_ALF 26
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#define N 100000
#define N_ITER 10
#define long_int unsigned long long int
long_int randf(long_int a){
*.aux
*.glo
*.idx
*.log
*.toc
*.ist
*.acn
*.acr
*.alg
*.bbl