Skip to content

Instantly share code, notes, and snippets.

@barahilia
barahilia / lines.py
Last active January 29, 2019 09:03
Lines on image
#!/usr/bin/env python
# http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_houghlines/py_houghlines.html
import cv2
import numpy as np
from rectangles import Line, line_frequencies, rectangles
def lines_to_file(lines):

A number of them

import Data.List
import Text.Regex
import System.Random
import Data.Ord
type Point = (Float,Float)
type Color = (Int,Int,Int)
type Polygon = [Point]
type Person = [Int]
type Link = [Point]
Here it goes
# Fresh repo and some master history
git init squash
cd squash/
echo one > a
git add .
git commit -m "First commit"
echo two >> a
git commit -m "Second commit"
git commit -am "Second commit"
@barahilia
barahilia / run-jasmine.js
Last active March 24, 2022 11:38 — forked from dlidstrom/run-jasmine.js
Runs Jasmine tests using PhantomJS. Adapted for use within TeamCity..Compatible with Jasmine 2.0.
var system = require('system'),
env = system.env;
/**
* Wait until the test condition is true or a timeout occurs. Useful for waiting
* on a server response or for a ui change (fadeIn, etc.) to occur.
*
* @param testFx javascript condition that evaluates to a boolean,
* it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or
* as a callback function.
@barahilia
barahilia / freezable_defaultdict.py
Created February 8, 2017 09:01
A defaultdict that can be frozen after which it will not add new missing keys but still return a default object
from collections import defaultdict
class freezable_defaultdict(dict):
def __init__(self, default_factory, *args, **kwargs):
self.frozen = False
self.default_factory = default_factory
super(freezable_defaultdict, self).__init__(*args, **kwargs)
def __missing__(self, key):