Skip to content

Instantly share code, notes, and snippets.

@embed
embed / gist:162705
Created August 5, 2009 14:41
PyGame + OpenCV
# -*- coding: utf-8 -*-
import pygame
import Image
from pygame.locals import *
import sys
import opencv
#this is important for capturing/displaying images
from opencv import highgui
/**
* Display video from webcam
*
* Author Nash
* License GPL
* Website http://nashruddin.com
*/
#include <stdio.h>
#include <stdlib.h>
unsigned hamdist(unsigned x, unsigned y)
{
unsigned dist = 0, val = x ^ y;
// Count the number of set bits (Knuth's algorithm)
while(val)
{
++dist;
val &= val - 1;
}
i=0;
q=0;
for a=1:10
for b=1:5
if i>3 q=1; break; end
end
if q==1; q=0; break; end
i=i+1
end
for i=1:length(Bmec)
if abs(Bmec(i))>=2
for j=1:(length(Bfou))
if abs(Bfou(j))>=2
while abs((Bfou(j)-Bmec(i))./Bmec(i)) > 0.05 %hata payi yuksek
g=g+g*0.1;%hava araligini arttir %10
[reg]=Fourier_open_circuit(g,delta_z,Rout_stat,Rin_stat,La,h_mag,h_rot_tooth,ts_y,Nr,Ns,rpm,mu_mr,Br,N,I);
Bfou=reg(6).Bp;
end
elseif (abs(Bfou(j)-Bmec(i))./Bmec(i)<=0.05) %hata payi uygun if dongusunden cikip bir sonraki Bmec degerine bak
#include<iostream>
using namespace std;
void f(int x)
{
x=5;
}
int main(int argc, char *argv[])
{
int i;
@embed
embed / gist:152232
Created July 22, 2009 20:05
hatali pointer ornegi
bool init(Screen *scr)
{
scr = new Screen(...);
...
}
int main()
{
Screen *screen;
@embed
embed / gist:152230
Created July 22, 2009 20:03
ne oldugunu ben de bilmiyorum
#include<iostream>
int main()
{
hebele;
std::cout << hubele<< "nanik << std:endl;
return 31;
}