Skip to content

Instantly share code, notes, and snippets.

View manav148's full-sized avatar

Manav Kundra manav148

View GitHub Profile
def recurse(li, depth = 3, result =[]):
if depth == 0:
return result
if not result:
return recurse(li, depth -1, zip(li) if depth > 1 else li)
else:
nr = [ (x,) + y for x in li for y in result]
return recurse(li, depth -1, nr)
recurse([0,1])
@manav148
manav148 / RabbitMQ.php
Last active August 29, 2015 14:08
RabbitMQ sample publisher
<?php
use PhpAmqpLib\Connection\AMQPConnection;
use PhpAmqpLib\Message\AMQPMessage;
class RabbitMQ{
private $AMQPConnection;
private $Channel;
private $queue_name;
@manav148
manav148 / phantomjs.py
Last active August 29, 2015 14:06
A simple class to instantiate phantomjs with selenium in python (with ssl support)
from selenium import webdriver
class PhantomJS(object):
"""
Starting PhantomJS and hooking with Selenium
Instantiate:
with PhantomJS() as phantomjs:
"""
def __init__(self, ssl= True, url = None):