This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int* meu_pre_kmp(char *pattern) | |
{ | |
int *g = malloc(sizeof(int)*strlen(pattern)); | |
int i, n=0, estado=1; | |
repi(i, 1, strlen(pattern)) | |
{ | |
if( pattern[n] != pattern[i] ) | |
{ | |
g[i]=0; | |
}else{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Classes de Operações de Banco de Dados. | |
* Autor: Ícaro Freire. | |
* Site: http://icarofreire.blogspot.com.br/ | |
* Email: [email protected] | |
*/ | |
class banco | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package treinamento.android; | |
import android.app.Activity; | |
import android.graphics.Bitmap; | |
import android.graphics.BitmapFactory; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.Paint; | |
import android.graphics.drawable.BitmapDrawable; | |
import android.graphics.drawable.Drawable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void swap(final Activity atividade, final View v, final int R_drawable_imagem_widget_1, final int R_drawable_imagem_widget_2) | |
{ | |
v.setBackgroundResource(R_drawable_imagem_widget_1); | |
new Thread(new Runnable() | |
{ | |
public void run() | |
{ | |
try{/* \/ Para a execução por N milissegundos. */ | |
Thread.sleep(200);/* <- 200 milissegundos.*/ | |
} catch (InterruptedException e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ctype.h> | |
#include <math.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define max(a,b)((a<b)?(b):(a)) | |
#define min(a,b)((b<a)?(b):(a)) | |
#define dif(a,b)(max(a,b)-min(a,b)) | |
#define rep(i,b) for(i=0;i<b;i++) | |
#define repi(i,a,b) for(i=a;i<b;i++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rob Pike ofereceu as seguintes "regras" em Notas para programação em C como máximas da programação de computadores, embora elas possam ser vistas como pontos da filosofia Unix: | |
• Regra 1: Você não pode dizer qual trecho de um programa é lento. Os gargalos ocorrem em locais que surpreendem, portanto, não tente supor e determinar uma solução até que tenha determinado exatamente onde se encontra o gargalo. | |
• Regra 2: Meça. Não otimize o programa até que você tenha medido o seu tempo de execução, e mesmo depois de medido o tempo, não otimize a menos que uma parte do código esteja gastando muito mais tempo em comparação com o restante do programa. | |
• Regra 3: Algoritmos extravagantes são lentos quando é pequeno, e é normalmente pequeno. Algoritmos extravagantes têm grandes constantes. Até que você saiba que torna-se freqüentemente grande, não seja extravagante. (Mesmo se tornar-se grande, use a Regra 2 primeiro.) | |
• Regra 4: Algoritmos extravagantes contém mais defeitos que algoritmos simples e são mais dif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Escrito por: Ícaro Freire Martins | |
* Data: 20/02/2015 | |
* [email protected] | |
* http://icarofreire.blogspot.com.br/ | |
* */ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <linux/module.h> | |
#include <linux/version.h> | |
#include <linux/kernel.h> | |
#include <linux/types.h> | |
#include <linux/kdev_t.h> | |
#include <linux/fs.h> | |
#include <linux/device.h> | |
#include <linux/cdev.h> | |
#include <asm/io.h> | |
#include <asm/uaccess.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: latin1 -*- | |
try: | |
import Xlib | |
from Xlib import X, display | |
from Xlib.ext.xtest import fake_input | |
except ImportError: | |
print 'Instalar a biblioteca python-xlib' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Inserir marca D'agua em uma imagem JPG; | |
* | |
* Para exibir a foto no site, vc colocará a seguinte definição abaixo no | |
* src da tag img do html: | |
* marca_d.php?ft=<arquivo da foto em jpg>&lg=<arquivo da logomarca em jpg> | |
* | |
* Exemplo: | |
* <img src='marca_d.php?ft=foto.jpg&lg=logo.jpeg' alt=''> |
OlderNewer