Skip to content

Instantly share code, notes, and snippets.

@dAnjou
dAnjou / _error_
Created July 22, 2012 20:41
Flask: circular import problem
Traceback (most recent call last):
File "server.py", line 8, in <module>
from models import User
File "/home/max/Projekte/flask-testing-stuff/models.py", line 1, in <module>
from server import db
File "/home/max/Projekte/flask-testing-stuff/server.py", line 8, in <module>
from models import User
ImportError: cannot import name User
#!/usr/bin/env python
import sys, os
import hashlib
import zipfile
VENDORS = {
# vendor desc : vendor id
'Google Inc.' : 'google',
'LG Electronics' : 'lge',
'Intel Corporation': 'intel_corporation',
@julionc
julionc / 00.howto_install_phantomjs.md
Last active March 24, 2025 17:27
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@madjar
madjar / scrapper.py
Last active March 5, 2023 15:02
A example of scrapper using asyncio and aiohttp
import asyncio
import aiohttp
import bs4
import tqdm
@asyncio.coroutine
def get(*args, **kwargs):
response = yield from aiohttp.request('GET', *args, **kwargs)
return (yield from response.read_and_close(decode=True))
@denilsonsa
denilsonsa / Python Virtual Environments on Debian and Ubuntu.md
Last active December 1, 2016 06:25
Python Virtual Environments on Debian and Ubuntu

pyvenv-3.3 (Ubuntu 13.10, also Debian)

Symptoms

pyvenv-3.3 venvdir
venvdir/bin/python -c 'import sys; print(sys.path)'
# This should print the venvdir in sys.path.

But in buggy Ubuntu/Debian, it doesn't.

@dqtweb
dqtweb / gist:5033fde8ce949686092c27848ecde148
Last active August 27, 2018 06:33
Technical analysis Indicators without Talib
import numpy
import pandas as pd
import math as m
#@author: Bruno Franca
#@author: Peter Bakker
#Moving Average
def MA(df, n):
MA = pd.Series(pd.rolling_mean(df['Close'], n), name = 'MA_' + str(n))