Skip to content

Instantly share code, notes, and snippets.

import json
import time
import ujson
NUM_OBJ_KEYS = 1000
NUM_RUNS = 1000000
obj = {}
for i in range(NUM_OBJ_KEYS):
obj[i] = 'foo'
/**
* @author Eugene Zatepyakin / http://inspirit.ru/
*
* this code is a rewrite from https://github.com/mtschirs/js-objectdetect implementation
* @author Martin Tschirsich / http://www.tu-darmstadt.de/~m_t
*/
(function(global) {
"use strict";
//
@ttezel
ttezel / gist:3160712
Created July 22, 2012 19:00
Some things I think will happen by 2020

#Some things I think will happen by 2020:

  1. The Voice interface will be mastered. We will be talking to computers and they will understand the meaning/context of our words, and help us live our lives. Siri is where it starts.

  2. Fully articulable, brain-controlled artificial limbs will be in existence. Amputees will have limbs replaced with an artificial limb, and continue to live fully enabled. Price would still be high at this time. There is already great progress in this area.

  3. Driverless cars will start to gain popularity. People who purchase an autonomous vehicle (e.g. Google's driverless car) will be sitting in their cars, working/entertaining themselves with mobile devices while they are driven around. Google is close to launching their autonomous car for sale. They are way ahead of the competition. Google will be heavy in the automotive game. They are lobbying to legalize Autonomous Vehicles in the US.

  4. We will have devices with morphable, touchable interface

@ttezel
ttezel / max_subarray
Created December 7, 2012 21:44
Max Subarray
/**
* Given an array of real numbers,
* returns the max contiguous subsequence for which
* the sum of the elements is maximized
*
* @param {Array} arr input array
* @return {Array} slice with maximum sum
*/
function maxSubarray (arr) {
//start & end indices for our max slice
@ttezel
ttezel / ECE 406 Algorithms notes.md
Last active December 10, 2015 21:39
ECE 406 Algorithms notes

#Class #2 Wed. Jan 9, 2013

End of last class

f = O(g) if there exist constants c and N s.t.

(notation: ∀ === for all)

f(n) ≤ g(n) ∀ n ≥ N

@ttezel
ttezel / gcd-euclid.m
Last active December 11, 2015 17:38
gcd algorithm (extended-euclid)
%{
Problem 7 (ii) - extended-euclid function
Given two integers a and b, it finds the largest integer that
divides both of them - known as their greatest common divisor (gcd).
Input: integers a and b where a >= b >= 0
Output : gcd(a, b)
%}
function result = euclid (a, b)
@ttezel
ttezel / extended_euclid.m
Created January 25, 2013 17:50
Extended Euclid Algo for finding the GCD of two integers. Works using Euclid's law: if `d` is the GCD of `a` and `b`, then there exists an `x` and `y` such that ```ax + by = d```
%{
Problem 7 (ii) - Extended Euclid
Input: positive integers a,b with a >= b >= 0
Output: integer array [ x,y,d ] such that
d = gcd(a,b) and ax + by = d
%}
function result = extended_Euclid (a, b)
if (b == 0)
@ttezel
ttezel / gist:6143316
Last active April 9, 2016 18:39
Elasticsearch fuzzy search scores the same for exact match and non-exact match
curl -XPOST 'http://localhost:9200/fuzzytest/' -d '
{
settings: {
index: {
analysis: {
analyzer: {
default: {
type: "custom",
tokenizer: "uax_url_email",
filter: [ "lowercase" ]
@ttezel
ttezel / gist:4142172
Last active July 31, 2016 08:53
quickly add jquery to a page
var script = document.createElement('script');
script.src = 'https://code.jquery.com/jquery.min.js';
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
@ttezel
ttezel / download_popular_insta_photos.js
Last active October 17, 2016 09:02
Download instagram photos with >= N likes (run from an instagram user's profile page)