Skip to content

Instantly share code, notes, and snippets.


Martin Sikora martinsik

View GitHub Profile
martinsik /
Last active Jan 22, 2021
Circle detection with OpenCV 3.0
import cv2
import time
import math
import numpy as np
capture = cv2.VideoCapture(0)
print capture.get(cv2.CAP_PROP_FPS)
t = 100
w = 640.0
View include-no-scope.js
// Alternative to Angular's ng-include that doesn't create new scopes.
module.directive('includeNoScope', function($http, $templateCache, $compile, $cacheFactory) {
return function(scope, element, attrs) {
var templatePath = attrs.staticInclude;
$http.get(templatePath, { cache: $templateCache }).success(function(response) {
var contents = element.html(response).contents();
View video_preview.html
Tutorial code for:
<!DOCTYPE html>
<html lang="en">
<a href="" target="_blank" class="video-preview" data-frames="100" data-source=""></a>
View Makefile
# Copyright (c) 2013 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# GNU Make based build file.  For details on GNU Make see:
martinsik / MyCalendar.h
Created Mar 8, 2013
Example of using EventKit on iOS 6+
View MyCalendar.h
#import <Foundation/Foundation.h>
@interface MyCalendar : NSObject
+ (void)requestAccess:(void (^)(BOOL granted, NSError *error))success;
+ (BOOL)addEventAt:(NSDate*)eventDate withTitle:(NSString*)title inLocation:(NSString*)location;
martinsik /
Last active Jul 9, 2018
Source codes for tutorial on Creating .mbtiles DB for iOS MapBox from hi-res map image
#import "ViewController.h"
#import "MapBox.h"
@implementation ViewController
- (void)viewDidLoad
[super viewDidLoad];
RMMBTilesSource *offlineSource = [[RMMBTilesSource alloc] initWithTileSetURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"chernarus" ofType:@"mbtiles"]]];
import os
import fnmatch
import unittest
import webapp2
import importlib
from time import clock
class RunUnitTests(webapp2.RequestHandler):
def get(self):
martinsik / parser.php
Created Oct 2, 2012
Simple sport results parser in PHP using XPath. For more information visit
View parser.php
$curl = curl_init('');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10');
$html = curl_exec($curl);
if (!$html) {
martinsik / index.html
Created Sep 6, 2012
Simple WebSocket server based on libwebsockets. For full description read
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<script src=""></script>
<script type="text/javascript">
$(function() {
window.WebSocket = window.WebSocket || window.MozWebSocket;
var websocket = new WebSocket('ws://',
martinsik / apd-php54.diff
Created Aug 11, 2012
Patch file for APD 1.0.1 that fixes bugs for PHP 5.4
View apd-php54.diff
--- php_apd.c.orig 2004-09-28 05:25:59.000000000 +0200
+++ php_apd.c 2012-08-11 10:59:29.000000000 +0200
@@ -70,7 +70,7 @@
/* List of exported functions. */
-function_entry apd_functions[] = {
+zend_function_entry apd_functions[] = {
PHP_FE(override_function, NULL)
PHP_FE(rename_function, NULL)