Skip to content

Instantly share code, notes, and snippets.

@arush15june
arush15june / custom_thread.py
Created July 30, 2018 20:10
Thread Killer
class thread(threading.Thread):
""" Extended Thread to allow handling SIGINT """
def __init__(self):
self.alive = True
threading.Thread.__init__(self)
class threadedLoop(thread):
""" asyncio loop inside a thread """
def __init__(self, *args, **kwargs):
thread.__init__(self)
@arush15june
arush15june / database.py
Last active April 28, 2018 02:58
cuckoo feeder
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
# Database
engine = None
if os.environ.get('DATABASE_URL') is not None:
engine = create_engine(os.environ.get('DATABASE_URL'), convert_unicode=True)
else:
@arush15june
arush15june / imgReduce.py
Created September 23, 2016 07:10
Image Reduce - Reduce Image sizes for crappy online forms
# Easy Image Size Reduction for Crappy
# Forms
# Input : imgReduce.py <file-name> <size to reduce to>
# by arush15june
import os,sys
from PIL import Image
file, size = sys.argv[1],sys.argv[2] # Image Path, Size (in KB)
@arush15june
arush15june / sheet.py
Created September 16, 2016 18:38
Contact Sheet X
"""
Contact Sheet (Passport Size)
Pass the image filename(s) as argument to the script and a pdf
contact sheet will be made
by - arush15june
"""
import sys,PIL
from PIL import Image,ImageOps
@arush15june
arush15june / results.py
Created March 23, 2016 03:57
CBSE Class X School Result Parser
import re,operator
from math import sqrt
"""
THIS SCRIPT PARSES SCHOOL RESULT TXT FILES OBTAINED FROM CBSE'S
WEBSITE. IT EXTRACTS THE ROLLNO,NAME,CGPA AND MARKS(in a dictionary).
CHANGE THE SUBJECT STRINGS IN THE DICTS TO YOUR NEEDS.
"""