This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**************************************************************************** | |
* Haskell-like automatic partial functions * | |
* * | |
* Copyright © 2014 Manuel Sánchez Pérez * | |
* * | |
* This program is free software. It comes without any warranty, to * | |
* the extent permitted by applicable law. You can redistribute it * | |
* and/or modify it under the terms of the Do What The Fuck You Want * | |
* To Public License, Version 2, as published by Sam Hocevar. See * | |
* http://www.wtfpl.net/ for more details. * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A simple proxy server. Usage: | |
http://hostname:port/p/(URL to be proxied, minus protocol) | |
For example: | |
http://localhost:8080/p/www.google.com | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://docs.wand-py.org | |
from wand.image import Image | |
with Image(filename='original.gif') as img: | |
img.rotate(90) | |
img.resize(150, 150) | |
img.save(filename='converted.gif') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from blueprint import example | |
from extensions import mail | |
from flask import Flask | |
import settings | |
def create_app(settings=settings): | |
ret_val = Flask(__name__) | |
ret_val.config.from_object(settings) | |
# initialize extensions... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cvxopt import matrix as cvxmat, sparse, spmatrix | |
from cvxopt.solvers import qp, options | |
import numpy as np | |
def quadprog(H, f, Aeq, beq, lb, ub): | |
""" | |
minimize: | |
(1/2)*x'*H*x + f'*x | |
subject to: | |
Aeq*x = beq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* $.pinger | |
* | |
* If your page runs into an iframe hosted by another domain, you may want to keep the session open. | |
* This plugin automates the "ping URL" process and provides some options. | |
* | |
* The pinger will ask the given URL every 'interval' minutes if it detects | |
* some activity by listening to the events listed in 'listen' parameter. | |
* | |
* Have a look to the 'defaults' variable below for further details about available parameters and default values. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
from operator import itemgetter | |
def iunzip(iterable): | |
"""Iunzip is the same as zip(*iter) but returns iterators, instead of | |
expand the iterator. Mostly used for large sequence""" | |
_tmp, iterable = itertools.tee(iterable, 2) | |
iters = itertools.tee(iterable, len(_tmp.next())) | |
return (itertools.imap(itemgetter(i), it) for i, it in enumerate(iters)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Initially written by Heather Piwowar, June 2011 | |
# Public domain: have at it! | |
# For exporting bibtex info into csv for running stats | |
import csv | |
import re | |
from pybtex.database.input import bibtex as bibtex_in | |
from pybtex.database.output import bibtex as bibtex_out | |
from operator import itemgetter, attrgetter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <boost/uuid/sha1.hpp> | |
void display(char* hash) | |
{ | |
std::cout << "SHA1: " << std::hex; | |
for(int i = 0; i < 20; ++i) | |
{ | |
std::cout << ((hash[i] & 0x000000F0) >> 4) | |
<< (hash[i] & 0x0000000F); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""SocksiPy - Python SOCKS module. | |
Version 1.00 | |
Copyright 2006 Dan-Haim. All rights reserved. | |
Redistribution and use in source and binary forms, with or without modification, | |
are permitted provided that the following conditions are met: | |
1. Redistributions of source code must retain the above copyright notice, this | |
list of conditions and the following disclaimer. | |
2. Redistributions in binary form must reproduce the above copyright notice, |
NewerOlder