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
""" | |
Determine whether a circle is a "Perfect Circle" or not. | |
To use this module you need: | |
python3.6 | |
PIL (https://pillow.readthedocs.io/en/4.2.x/installation.html#basic-installation) | |
>>> from perfect_circle import is_perfect_circle | |
>>> from PIL import Image | |
>>> image = Image.open('/some/path/to/circle.jpg') |
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 time | |
from scrapy.downloadermiddlewares.retry import RetryMiddleware | |
from scrapy.utils.response import response_status_message | |
class PauseOnStatusMiddleware(RetryMiddleware): | |
""" | |
When encountering a 503 error from amazon, pause the request for TIMEOUT seconds and retry |
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 -*- | |
# Scrapy settings for ScrapyChip project | |
# | |
# For simplicity, this file contains only the most important settings by | |
# default. All the other settings are documented here: | |
# | |
# http://doc.scrapy.org/en/latest/topics/settings.html | |
# |
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
(function() { | |
function getSessionCookies() { | |
var cookieArray = new Array(); | |
var cName = /^\s?incap_ses_/; | |
var c = document.cookie.split(";"); | |
for (var i = 0; i < c.length; i++) { | |
var key = c[i].substr(0, c[i].indexOf("=")); | |
var value = c[i].substr(c[i].indexOf("=") + 1, c[i].length); | |
if (cName.test(key)) { | |
cookieArray[cookieArray.length] = value; |
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
""" | |
For use with python3. | |
Usage: Download and save this script in your project folder. | |
In the script: | |
from incap import IncapSession as Session | |
session = Session() | |
response = session.get('https://www.url.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
#!/bin/bash | |
# | |
# schedulix_install.sh | |
# | |
# ###################### NOTE ##################### | |
# There will be an error when attempting to access mysql 'root'@'localhost'. | |
# To fix this issue, | |
# - stop mysql | |
# sudo /etc/init.d/mysql stop | |
# - start mysqld configuration |
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
#!/bin/bash | |
# install instructions taken from https://renoirboulanger.com/blog/2015/04/upgrade-python-2-7-9-ubuntu-14-04-lts-making-deb-package/ | |
# update apt | |
sudo apt-get update | |
# install build dependencies | |
sudo apt-get install -y gcc-multilib g++-multilib libffi-dev libffi6 libffi6-dbg python-crypto python-mox3 python-pil python-ply libssl-dev zlib1g-dev libbz2-dev libexpat1-dev libbluetooth-dev libgdbm-dev dpkg-dev quilt autotools-dev libreadline-dev libtinfo-dev libncursesw5-dev tk-dev blt-dev libssl-dev zlib1g-dev libbz2-dev libexpat1-dev libbluetooth-dev libsqlite3-dev libgpm2 mime-support netbase net-tools bzip2 python-dev |
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
""" | |
This middleware will allow you to specify status codes to retry after a specified wait timeout period. | |
""" | |
import time | |
from scrapy.contrib.downloadermiddleware.retry import RetryMiddleware | |
from scrapy.utils.response import response_status_message | |
class PauseOnStatusMiddleware(RetryMiddleware): |
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
#!/bin/bash | |
# RUN AS SUDO | |
# install instructions taken from here http://www.kaffeetalk.de/how-to-setup-and-configure-mysql-with-unixodbc-under-ubuntu-14-04/ | |
# install and configure mysql client | |
sudo apt-get install mysql-client | |
# install odbc drivers |
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 java.io.IOException; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
import java.util.Date; | |
import java.util.Random; | |
import javax.xml.parsers.DocumentBuilder; | |
import javax.xml.parsers.DocumentBuilderFactory; | |
import javax.xml.parsers.ParserConfigurationException; |
NewerOlder