Skip to content

Instantly share code, notes, and snippets.

View cuuupid's full-sized avatar
💘

❤️ cuuupid

💘
View GitHub Profile
@cuuupid
cuuupid / stream.py
Created February 26, 2018 17:43
Avoid HTTP Timeout
from sanic import Sanic
from sanic.response import stream
from sanic_cors import CORS, cross_origin
from time import sleep
app = Sanic()
CORS(app)
@app.route('/api', methods=['POST'])
@cuuupid
cuuupid / ebsmash.py
Created February 20, 2018 14:03
Eventbrite Bot-smashing in Python with Selenium
import sys
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from time import sleep
# import star_me_daddy.utils
from console_logging.console import Console
console = Console()
from multiprocessing.dummy import Pool
@cuuupid
cuuupid / image_magick_install.sh
Created December 17, 2017 23:21
Install ImageMagick on Ubuntu (or WSL)
wget https://www.imagemagick.org/download/ImageMagick.tar.gz
tar xvzf ImageMagick.tar.gz
cd ImageMagick-*
./configure
make
sudo make install
sudo ldconfig /usr/local/lib
@cuuupid
cuuupid / sleepsort.py
Last active December 5, 2017 21:33
SleepSort is a new sorting algorithm that sorts by time.
from time import sleep
from math import log
from multiprocessing.dummy import Pool
nums = [float(x) for x in input('Positive numbers to sort, delimited by space: ').split(' ')]
def sleepsort(x): sleep(log(x)); print(x, end=' ') # O(log(n)) :)
pool=Pool(10)
pool.map(sleepsort, nums)
@cuuupid
cuuupid / Headless.py
Created November 21, 2017 06:52
Headless ChromeDriver with selenium
from selenium.webdriver.chrome.options import Options
opts = Options()
opts.add_argument("headless")
# opts.add_argument('no-sandbox')
opts.add_argument('window-size=1200x600')
opts.add_argument('disable-gpu')
opts.add_argument(
"user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36")
driver = webdriver.Chrome(chrome_options=opts)
import pyttsx
import speech_recognition as sr
from console_logging import console
import sys
import os
import requests
_this = sys.modules[__name__]
console.info("Initializing TTS engine...")