Skip to content

Instantly share code, notes, and snippets.

View alertor's full-sized avatar

Stefan Taranu alertor

  • Bucharest, Romania
View GitHub Profile
@alertor
alertor / opencv-install.txt
Last active August 29, 2015 14:03
Installing OpenCV on Ubuntu 14.04
[compiler] sudo apt-get install build-essential
[required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
[optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
cd ~/<my_working _directory>
git clone https://github.com/Itseez/opencv.git
mkdir build
cd build
#!/bin/bash
EXITCODE="0"
SERVICES=(
"memcached &"
"mongod &"
"redis-server &"
"neo4j start"
"elasticsearch"
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
fabfile for Django
------------------
see http://morethanseven.net/2009/07/27/fabric-django-git-apache-mod_wsgi-virtualenv-and-p/
modified for fabric 0.9/1.0 by Hraban (fiëé visuëlle)
several additions, corrections and customizations, too
#!/usr/bin/env python
from __future__ import with_statement # needed for python 2.5
from fabric.api import *
from fabric.contrib.console import confirm
from fabric.contrib import files
USAGE = """
================================================================
NOTE:
using this fabfile expects that you have the python utility
@alertor
alertor / zodiac.py
Created August 28, 2014 12:03
get zodiacal sign by DD-MM
# from http://stackoverflow.com/questions/3274597/how-would-i-determine-zodiac-astrological-star-sign-from-a-birthday-in-python
from bisect import bisect
signs = [(1,20,"Cap"), (2,18,"Aqu"), (3,20,"Pis"), (4,20,"Ari"),
(5,21,"Tau"), (6,21,"Gem"), (7,22,"Can"), (8,23,"Leo"),
(9,23,"Vir"), (10,23,"Lib"), (11,22,"Sco"), (12,22,"Sag"),
(12,31,"Cap")]
def zodiac_sign(m,d):
return signs[bisect(signs,(m,d))][2]
assert zodiac_sign(3,9) == "Pis"
@alertor
alertor / parallel.py
Created September 11, 2014 11:00
python parallel jobs
from joblib import Parallel, delayed
import multiprocessing
inputs = range(100000)
def processInput(i):
return i * i
num_cores = multiprocessing.cpu_count()
print str(num_cores)
@alertor
alertor / designer.html
Created October 3, 2014 10:44
designer
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-item/core-item.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
@alertor
alertor / txredns.py
Created September 24, 2015 18:48 — forked from fcoury/txredns.py
Python/Twisted/Redis backed DNS server.
# Python/Twisted/Redis backed DNS server - resolves from NAME to IP addrs
# fallback to google or any other DNS server to resolv domains not present on Redis
# to set a new domain on redis, just issue a SET domain.tld ip_addr
# run with twistd -ny txredns.tac
# gleicon 2011
from twisted.names import dns, server, client, cache
from twisted.application import service, internet
from twisted.internet import defer
from twisted.python import log
@alertor
alertor / pdns-pipebackend.py
Created September 25, 2015 23:11 — forked from sokratisg/pdns-pipebackend.py
PowerDNS PipeBackend python example
#!/usr/bin/python -u
import sys, os, time
import random
class DNSLookup(object):
"""Handle PowerDNS pipe-backend domain name lookups."""
ttl = 30
@alertor
alertor / logstash-supervisord
Created November 6, 2015 08:18 — forked from vmadman/logstash-supervisord
An example SupervisorD configuration for all three logstash components. Some of it might look obvious, but it took a ton of tweaking to figure it out. (but I might just be dumb)
[program:lss]
process_name=Shipper
command=java -jar /usr/local/logstash/bin/logstash-1.1.9-monolithic.jar agent --config /usr/local/logstash/conf/shipper.conf --log /usr/local/logstash/log/shipper.log
user=logstash
startretries=3
redirect_stderr=true
std_out_logfile=NONE
startsecs=3
environment=HOME="/usr/local/logstash/"