This file contains hidden or 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
| #!/bin/bash | |
| # | |
| # Sample for getting temp session token from AWS STS | |
| # | |
| # aws --profile youriamuser sts get-session-token --duration 3600 \ | |
| # --serial-number arn:aws:iam::012345678901:mfa/user --token-code 012345 | |
| # | |
| # Based on : https://github.com/EvidentSecurity/MFAonCLI/blob/master/aws-temp-token.sh | |
| # |
This file contains hidden or 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 | |
| """ | |
| Produces load on all available CPU cores | |
| """ | |
| from multiprocessing import Pool | |
| from multiprocessing import cpu_count | |
| def f(x): | |
| while True: |
This file contains hidden or 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
| #!/bin/sh | |
| # Make sure to: | |
| # 1) Name this file `backup.sh` and place it in /home/ubuntu | |
| # 2) Run sudo apt-get install awscli to install the AWSCLI | |
| # 3) Run aws configure (enter s3-authorized IAM user and specify region) | |
| # 4) Fill in DB host + name | |
| # 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket) | |
| # 6) Run chmod +x backup.sh | |
| # 7) Test it out via ./backup.sh |
This file contains hidden or 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 requests | |
| import re | |
| import time | |
| from lxml import etree | |
| from multiprocessing.dummy import Pool as ThreadPool | |
| from pymongo import MongoClient | |
| db= MongoClient()['mysmartprice'] | |
| category_url_list=['http://www.mysmartprice.com/mobile',] | |
| # 'http://www.mysmartprice.com/computer', |
This file contains hidden or 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 __future__ import divison | |
| from lxml import html | |
| import requests | |
| from multiprocessing.dummy import Pool as ThreadPool | |
| import json | |
| import math | |
| from math import ceil | |
| limit=47 | |
| page_offset=1 |
This file contains hidden or 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 upload_file(): | |
| 'This View will handle the uploaded excel file' | |
| if request.method == 'POST': | |
| files = request.files.getlist('file') | |
| print "files are ", files | |
| index = 0 | |
| for file in files: | |
| if file and allowed_file(file.filename): | |
| filename = secure_filename(file.filename) | |
| file.save(os.path.join(UPLOAD_FOLDER, filename)) |