Skip to content

Instantly share code, notes, and snippets.

@zsrinivas
zsrinivas / shedtasks.py
Created January 8, 2016 19:15
scheduling tasks with expiration and priority.
from heapq import heappush, heappop, heapify
class Scheduler(object):
def __init__(self):
self.heap_a = []
self.heap_b = []
self.useless_a = 0
self.useless_b = 0
self.expiration = float('-inf')
from heapq import heappush, heappop, heapify
class Scheduler(object):
def __init__(self):
self.heap_a = []
self.heap_b = []
self.useless_a = 0
self.useless_b = 0
@zsrinivas
zsrinivas / shedtasks_a.py
Last active January 8, 2016 19:11
scheduling tasks
from heapq import heappush, heappop, heapify
class Scheduler(object):
def __init__(self):
self.heap_a = []
self.heap_b = []
self.useless_a = 0
self.useless_b = 0
@zsrinivas
zsrinivas / requirements.txt
Created December 28, 2015 15:29
requirements.txt
--index-url https://pypi.python.org/simple/
Flask==0.10.1
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
psycopg2==2.6.1
requests==2.9.1
six==1.10.0
SQLAlchemy==1.0.11
SQLAlchemy-Utils==0.31.4
@zsrinivas
zsrinivas / minmove.cc
Created December 19, 2015 13:11
spoj minmove
#include <bits/stdc++.h>
#ifdef __mr__
#include "prettyprint.hpp"
#else
#define endl '\n'
#endif
#define uint unsigned int
#define ulong unsigned long long
using namespace std;
@zsrinivas
zsrinivas / expedi.cc
Created December 18, 2015 15:29
spoj expedi
#include <bits/stdc++.h>
#ifdef __mr__
#include "prettyprint.hpp"
#else
#define endl '\n'
#endif
#define uint unsigned int
#define ulong unsigned long long
using namespace std;
import os
import re
from getpass import getpass
from requests import Session
from contextlib import contextmanager
STATUS_PAGE = "http://www.spoj.com/status/{problem},{username}/"
MYACCOUNT_PAGE = "http://www.spoj.com/myaccount/"
SOLUTION_PAGE = "http://www.spoj.com/files/src/save/{sol_id}"
HOME_PAGE = "https://www.spoj.com/"
import os
import re
from getpass import getpass
from requests import Session
from contextlib import contextmanager
STATUS_PAGE = "http://www.spoj.com/status/{problem},{username}/"
MYACCOUNT_PAGE = "http://www.spoj.com/myaccount/"
SOLUTION_PAGE = "http://www.spoj.com/files/src/save/{sol_id}"
HOME_PAGE = "https://www.spoj.com/"
import os
import re
from getpass import getpass
from requests import Session
STATUS_PAGE = "http://www.spoj.com/status/{problem},{username}/"
MYACCOUNT_PAGE = "http://www.spoj.com/myaccount/"
SOLUTION_PAGE = "http://www.spoj.com/files/src/save/{sol_id}"
HOME_PAGE = "https://www.spoj.com/"
@zsrinivas
zsrinivas / downsols.py
Created December 17, 2015 16:48
downloads spoj solutions
import os
import re
from getpass import getpass
from requests import Session
STATUS_PAGE = "http://www.spoj.com/status/{problem},{username}/"
MYACCOUNT_PAGE = "http://www.spoj.com/myaccount/"
SOLUTION_PAGE = "http://www.spoj.com/files/src/save/{sol_id}"
HOME_PAGE = "https://www.spoj.com/"