Skip to content

Instantly share code, notes, and snippets.

import requests
from bs4 import BeautifulSoup
import tqdm
import hashlib
from os import listdir
from os.path import isfile, join
root = 'http://download.geofabrik.de/'
import shutil
import sys
def naloga5():
maxIter = 10
planes = np.load('letala.npy')
step = 20
fig, pltarr = rv.plt.subplots(2,2)
errors = []
for unalignedPlane in planes[1:5]:
reg = pc.rigid_registration(planes[0][::step,:], unalignedPlane[::step,:], maxIterations=maxIter)
def addHomCoord3D(iPts):
if iPts.shape[-1] == 4:
return iPts
else:
return np.hstack((iPts, np.ones((iPts.shape[0], 1))))
def transAffine3D(iScale=(1, 1, 1), iTrans=(0, 0, 0), iRot=(0, 0, 0), iShear=(0, 0, 0, 0, 0, 0)):
def naloga2():
planes = np.load('letala.npy')
first = np.matrix(planes[0])
fig, pltarr = rv.plt.subplots(1)
ogCenter = (np.sum(first[:, 0]) / len(first), np.sum(first[:, 1] / len(first)))
matrix = rv.transAffine2D()
for i in range(int(360 / 5)):
matrix = rv.transAffine2D(iRot=5)
def cnn_detect_object(path):
args = { "prototxt": "cnn/bvlc_googlenet.prototxt",
"model": "cnn/bvlc_googlenet.caffemodel",
"labels": "cnn/synset_words.txt"}
# load the input image from disk
image = cv2.imread(path)
# load the class labels from disk
rows = open(args["labels"]).read().strip().split("\n")
@tinesubic
tinesubic / exdoc.js
Created January 14, 2017 12:34
Example for APIDOC tools
/**
* Created by tines on 19/04/2016.
*/
'use strict';
var express = require('express');
var path = require('path');
var router = express.Router();
var middleware = require('../handlers/middleware');
'use strict';
var assert = require('assert');
var request = require('supertest');
var server = require('../server.js');
var userToken = "testuser";
var testGroupId = 0;
// test if NODE_ENV is set to "test"
@tinesubic
tinesubic / Conditional compilation
Created January 6, 2017 11:49
Preprocessor examples
#define DEBUG_1 0
//Because DEBUG_1 is set to zero, the else
//clause will be removed from code before compilation.
#if DEBUG_1 == 0
processNoDebug();
#else
processWithDebug()
#endif
@tinesubic
tinesubic / bf.asm
Last active November 18, 2016 18:27
.helloworld ++++++++++[>+>+++>+++++++>++++++++++<<<<-]>>>++.>+.+++++++..+++.<<++.>+++++++++++++++.>.+++.------.--------.<<+.<.
.square numbers from 0...1000 ++++[>+++++<-]>[<+++++>-]+<+[>[>+>+<<-]++>>[<<+>>-]>>>[-]++>[-]+>>>+[[-]++++++>>>]<<<[[<++++++++<++>>-]+<.<[>----<-]<]<<[>>>>>[>>>[-]+++++++++<[>-<-]+++++++++>[-[<->-]+[<<<]]<[>+<-]>]<<-]<<-]
.powers of two: >++++++++++>>+<+[[+++++[>++++++++<-]>.<++++++[>--------<-]+<<]>.>[->[<++>-[<++>-[<++>-[<++>-[<-------->>[-]++<-[<++>-]]]]]]<[>+<-]+>>]<<]
.cat tool, stdin to stdout: ,[.,]
.sierpinski: >++++[<++++++++>-]>++++++++[>++++<-]>>++>>>+>>>+<<<<<<<<<<[-[->+<]>[-<+>>>.<<]>>>[[->++++++++[>++++<-]>.<<[->+<]+>[->++++++++++<<+>]>.[-]>]]+<<<[-[->+<]+>[-<+>>>-[->+<]++>[-<->]<<<]<<<<]++++++++++.+++.[-]<]+++++
.display ascii characters: .+[.+]
.***** PROGRAM MAIN START *****
bf START 0
@tinesubic
tinesubic / MPI_alg.c
Created September 5, 2016 12:15
PS Final Parallelization Code
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<time.h>
#include<sys/time.h>
#include <limits.h>
#include <mpi.h>
#define PI 3.14159265358979323846