Skip to content

Instantly share code, notes, and snippets.

View david-batranu's full-sized avatar

David Bătrânu david-batranu

View GitHub Profile
SDL_Surface *load_image(std::string filename) {
SDL_Surface* loadedImage = NULL;
SDL_Surface* optimizedImage = NULL;
loadedImage = IMG_Load(filename.c_str());
if (loadedImage != NULL) {
optimizedImage = SDL_DisplayFormat(loadedImage);
SDL_FreeSurface(loadedImage);
}
pygame.image.load(filename).convert()
# cache of http://download.zope.org/Zope2/index/2.13.19/versions.cfg
[buildout]
extends = http://download.zope.org/zopetoolkit/index/1.0.7/ztk-versions.cfg
versions = versions
[versions]
# Zope2-specific
Zope2 = 2.13.19
AccessControl = 2.13.11
@david-batranu
david-batranu / gist:6746365
Created September 28, 2013 20:46
ffmpeg streaming infra red camera from kinect
#grabFrame.py:
#!/usr/bin/env python
import time
import sys
import cv
import cv2
cam = cv2.VideoCapture(-1)
void main(){
int a[1000]={ 0 };
int z, m, y, sum_1, n;
z = m = y = sum_1 = 0;
a[0]= 1;
while(z != 1000){
for(n = 0; n <= m; n++){
a[n] = a[n] * 2 + y;
#include<stdlib.h>
#include<stdio.h>
struct bin_tree {
long key, value;
struct bin_tree *right, *left;
};
typedef struct bin_tree node;
collatz = {1:1}
def Collatz(n):
global collatz
if not collatz.has_key(n):
if n%2 == 0:
collatz[n] = Collatz(n/2) + 1
else:
collatz[n] = Collatz(3*n + 1) + 1
return collatz[n]
/*
* main.cpp
*
* Created on: Oct 23, 2013
* Author: david
*/
#include <iostream>
#include <map>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
int main(){
unsigned int maxRecord = 0;
unsigned int upperBound = 1000000;
unsigned int chainLen[upperBound + 1];
size_t x;
private class DownloadWebPageTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... urls) {
String result = new String();
try {
URL location = new URL(url);
URLConnection connection = location.openConnection();
BufferedReader data = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
while ((line = data.readLine()) != null) {