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 pyvirtualdisplay import Display | |
from selenium import webdriver | |
import sys | |
from optparse import OptionParser | |
from PIL import Image | |
parser= OptionParser() | |
parser.add_option("--width",action="store", dest="w", type="int", default="300") | |
parser.add_option("--height",action="store", dest="h", type="int", default="250") | |
parser.add_option("--output",action="store", dest="op", type="string", default= './thumbnail.png') | |
(options,args)=parser.parse_args(sys.argv[1:]) |
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
sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev | |
curl -L https://get.rvm.io | bash -s stable --ruby | |
rvm remove ruby-1.9.3-p194 | |
rvm pkg install zlib | |
rvm install ruby-1.9.3-p194 |
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 postmonkey import PostMonkey | |
pm = PostMonkey('341a2fc9bc064c33a3481f905d22b069-us5') | |
#storytellers | |
pm.listSubscribe(id='d3bb445eae',email_address='iamsidd@gmail.com') | |
#basic_users | |
pm.listSubscribe(id='13cbfa7eb2',email_address='iamsidd@gmail.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
>>> import couchdb | |
>>> couch = couchdb.Server() | |
>>> db = couch['catalog_users'] | |
>>> doc = db['f893955fc22b7ff25fd5d3764a009354'] | |
>>> doc | |
<Document 'f893955fc22b7ff25fd5d3764a009354'@'19-ea4b426d433b779ff9ed8267b989714e' {'home_zipcode': '', 'city': '', 'fb_user_id': '', 'zipcode': '', 'state': '', 'type': 'Publisher', 'email': 'iamsidd@gmail.com', 'media_url': '', 'status': 'active', 'bio': '', 'couchrest-type': 'Publisher', 'passwd': '97032c0a89cba64bd10f7d221c589f60', 'address1': '', 'address2': '', 'auth': '59b58778-eb69-11e0-9bea-1231390b25d1', 'dob': '', 'key': '59b58778-eb69-11e0-9bea-1231390b25d1', 'super_publisher_id': 'a36c91061da18c0c1ba1c3412409d8aa', 'created_ts': 1338361447, 'name': '', 'access_token': '', 'gender': '', 'publisher_revenue': 0.5, 'customer_type': 'storyteller', 'stories': ['273374'], 'updated_ts': 1338361470, 'published': True}> | |
>>> doc['internal_rating'] = 4 | |
>>> db.save(doc) | |
('f893955fc22b7ff25fd5d3764a009354', '20-f5c36653f45f853570f3399793ea560f') |
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
def email_story(worker,job): | |
email = json.loads(job.data) | |
if email.has_key("html"): | |
text_subtype = 'html' | |
else: | |
text_subtype = 'plain' | |
send_to = [] | |
send_to = parse_emails(email['to']) | |
content="""\ |
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
# -*- coding: utf-8 -*- | |
import os | |
import scrapy | |
from scrapy.spiders import CrawlSpider, Rule | |
from scrapy.linkextractors import LinkExtractor | |
from hashlib import md5 | |
from pymongo import MongoClient | |
client = MongoClient('localhost', 27017) | |
db = client.skoovbot |
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 string import strip | |
def format_name(name): | |
#Step 1: Split by , | |
#Step 2: Remove any extrac white space in tokens using Map | |
#Step 3: Reverse List using ::-1 | |
#Step 4: Join with White Space | |
return " ".join(map(strip, name.split(","))[::-1]) | |
>>> format_name("Shah, Saheb") | |
'Saheb Shah' |
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
cd ../../frontend/ | |
rm -rf dist | |
yeoman build | |
cd ../src/ratingui | |
rm -rf static/styles | |
rm -rf static/scripts | |
rm -rf templates/layout/rating.jinja | |
cp -vr ../../frontend/dist/styles static | |
cp -vr ../../frontend/dist/scripts static | |
cp ../../frontend/dist/index.html templates/layout/rating.jinja |
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
int inPins[] = {2,3,4,5}; | |
int totalInPins = 4; | |
const int DELAY_PERIOD = 70; | |
void setup() { | |
for(int i=0; i < totalInPins; i++){ | |
pinMode(inPins[i], INPUT); | |
} |
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 processing.serial.*; | |
int serialData = 0; | |
Serial GamePad; | |
int x = 100; | |
int y = 70; | |
void setup() { | |
size(200, 200); |
OlderNewer