Skip to content

Instantly share code, notes, and snippets.

View sourcepirate's full-sized avatar
🏠
Work and pray

Sathya Narrayanan sourcepirate

🏠
Work and pray
View GitHub Profile
import re
strings = """every day at 11:30
every 2nd week tuesday at 11:30
every 5 mins
"""
grammer = {
"G": "every <DAY_CTX> | <WEEK_CTX> | <MIN_CTX>",
"WEEK_CTX": "<WEEK> week <DAY_CTX>",
@sourcepirate
sourcepirate / pipes.py
Created October 6, 2017 09:22 — forked from zacharyvoase/pipes.py
pipes.py - Command-piping syntax for generators/coroutines in Python.
# -*- coding: utf-8 -*-
# pipes.py - Command-piping syntax for generators/coroutines in Python.
"""
pipes.py - Command-piping syntax for generators/coroutines in Python.
Example:
>>> from pipes import *
>>> chain1 = counter(5) | adder(2)
@sourcepirate
sourcepirate / elastic.yml
Created July 4, 2017 01:46
cluster using elasticsearch
elasticsearch_master:
image: elasticsearch:latest
command: "elasticsearch -Des.cluster.name=workagram -Des.node.master=true -Des.node.data=false"
environment:
- ES_JAVA_OPTS="-Xms512m -Xmx512m"
ports:
- "9200:9200"
- "9300:9300"
elasticsearch1:
@sourcepirate
sourcepirate / amazon-river-wave.py
Created July 2, 2017 08:13
Scrapping all amazon laptops data.
"""scrape amazon laptop and desktop prices"""
import os
import queue
import asyncio
import warnings
import peewee as db
from multiprocessing.managers import SyncManager
from multiprocessing import Process, RLock
from data import data
@sourcepirate
sourcepirate / scrapper.py
Last active July 1, 2017 17:56
Distibuted crawler in python
import queue
from multiprocessing.managers import SyncManager
from multiprocessing import Process, RLock
from bs4 import BeautifulSoup
from urllib import request
from urllib.parse import urlparse, urljoin
from multiprocessing.managers import MakeProxyType
BaseSetProxy = MakeProxyType('BaseSetProxy', ('__and__', '__contains__', '__iand__', '__ior__',
'__isub__', '__ixor__', '__len__', '__or__', '__rand__', '__ror__', '__rsub__',
{"posts": {"children": [1, 2,3, 4], "new": {"hello": "world"}}}
@sourcepirate
sourcepirate / grad.py
Created May 15, 2017 12:12
gradient descent algorithm
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
def hypothesis(x, theta):
"""function"""
return x.dot(theta).sum()
def compute_cost(X, Y, theta):
"""errors"""
import requests
from multiprocessing import Queue, Process, Pool
from peewee import *
db = SqliteDatabase('github.db')
class Github(Model):
name = CharField(unique=True)
no_repos = IntegerField()
no_follower = IntegerField()