Skip to content

Instantly share code, notes, and snippets.

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...")
@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)
@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 / 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 / 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 / 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 / plagiarism_checker.py
Created March 15, 2018 01:55
Identify keywords in text
from sumy.parsers.plaintext import PlaintextParser
from sumy.nlp.tokenizers import Tokenizer
from sumy.summarizers.lsa import LsaSummarizer as Summarizer
from sumy.nlp.stemmers import Stemmer
from sumy.utils import get_stop_words
LANG = "english"
tokenizer = Tokenizer(LANG)
stemmer = Stemmer(LANG)
summarizer = Summarizer(stemmer)
@cuuupid
cuuupid / a_million_commits.sh
Last active November 19, 2021 21:42
Gitsploit
# a million commits
for Y in {1999..2018}
do
mkdir $Y
cd $Y
for M in {01..12}
do
mkdir $M
cd $M
for D in {01..31}
@cuuupid
cuuupid / search.py
Last active March 22, 2018 15:35
IC LDap in Python 3
import logging
import ldap, ldap.filter
def connect():
conn = ldap.initialize('ldaps://unixldap.cc.ic.ac.uk')
conn.simple_bind_s()
return conn
def search(conn, user, return_list=True):
if not isinstance(user, list):
Verifying my Blockstack ID is secured with the address 1BYhPgFNU3o7hrgNoVotnESwm6NkUw1KXP https://explorer.blockstack.org/address/1BYhPgFNU3o7hrgNoVotnESwm6NkUw1KXP