r/madeinpython • • Aug 18 '20

Twitter Bot that Tweets Daily Deals from Amazon

23 Upvotes

Hey guys, idk if you remember me from a week or two ago but I posted on reddit that I used Python to make a twitter bot that tweets daily deals from Amazon. Every day a few tweets are sent out with a description in each tweet (link, price, title, etc.). Also, each tweet represents a product from a popular category (electronics, clothing, home, etc.).

I used some advice from my commenters and now my bot posts high-quality products with sales that are at least 20% off. In addition, it will post products that have at least a 4-star rating. Please follow and share this with your friends and family! I will follow back. Link to the bot is below. Thank you.

Link: https://twitter.com/daily_Deals_Bot


r/madeinpython • • Aug 15 '20

A Python Bot that spawned 200 cars for me, so I can destroy them!

Thumbnail
youtu.be
23 Upvotes

r/madeinpython • • May 07 '20

A Very Simple Terrain Generator

23 Upvotes

I was looking into making a terrain generator for a table top style game and decided it was a good opportunity to learn something. So after a few different techniques I've landed with this:

import numpy as np
import random
import matplotlib
from matplotlib import pyplot as plt
import matplotlib.colors as colors

class MidpointNormalize(colors.Normalize):
    def __init__(self, vmin=None, vmax=None, vcenter=None, clip=False):
        self.vcenter = vcenter
        colors.Normalize.__init__(self, vmin, vmax, clip)

    def __call__(self, value, clip=None):
        # I'm ignoring masked values and all kinds of edge cases to make a
        # simple example...
        x, y = [self.vmin, self.vcenter, self.vmax], [0, 0.5, 1]
        return np.ma.masked_array(np.interp(value, x, y))

def do_something():
    _l = np.linspace(.4,.8,8)
    _v = random.choice(_l)
    return _v

def create_border(shape):
    x = random.randrange(2,np.shape(shape)[0])
    y = random.randrange(2,np.shape(shape)[1])
    #x,y= np.shape(shape)
    border = np.ones((x,y))
    delta = np.ones((x-2,y-2))
    delta = np.negative(delta)
    r,c = 1,1
    border[r:r + delta.shape[0], c:c +delta.shape[1]] += delta
    border = rectify_border(border)
    delta = rectify_delta(delta)
    border[r:r + delta.shape[0], c:c + delta.shape[1]] += delta
    return border

def rectify_border(border):
    out = np.where(border>0)
    coords = [i for i in zip(*out)]
    chosen = random.sample(coords,2*len(coords)//3)
    remainder = [i for i in coords if i not in chosen]
    for _r,_c in coords:
        if (_r,_c) in chosen:
            v = do_something()
            border[_r][_c] += v
        else:
            pass
        border[_r][_c] -=1
    return border

def rectify_delta(delta):
    delta += 1
    delta += (np.random.randint(0,35, size=np.shape(delta))/100)
    return delta

def evolve(world,feature):
    x = create_border(feature)
    x_max = np.shape(world)[0] - np.shape(x)[0]
    x_val = random.randrange(0, x_max)
    y_max = np.shape(world)[1] - np.shape(x)[1]
    y_val = random.randrange(0, y_max)
    world[x_val:x_val + np.shape(x)[0], y_val:y_val + np.shape(x)[1]] += x

    return world
def colour(world):
    plt.figure()

    top = plt.cm.terrain(np.linspace(.36,1,256))
    #mid = plt.cm.terrain(np.linspace(.36,.72,256))
    bot = plt.cm.terrain(np.linspace(0,.36,256))
    all = np.vstack([bot,top])

    spec = colors.LinearSegmentedColormap.from_list("Mountain", all)
    divnorm = MidpointNormalize(vmin = np.min(world), vcenter= np.mean(world), vmax=np.amax(world))
    plt.imshow(world, alpha=.9, origin='lower', cmap=spec, interpolation='spline36', norm=divnorm)
    return plt.show()

r,c = 1,1

world = np.zeros((15,15))

feature = np.zeros((8,8))

generation = 20
while generation:
    world + evolve(world,feature)
    generation -= 1
print(world)
colour(world)

This was specifically created to make a mountain feature so i'm looking to expand on it a little bit so I can fully generate a world map with towns and dungeons.

Sample Images

Edit: after playing around with it.

You can change values for

  • world size: will give a more random spread of the terrain

  • feature size: this affects how much area is affected per generation. Larger values can reduce diversity, but can populate with less generations. Smaller values lead to better diversity but require more generations

  • generation: this is affected by feature size, but it will ultimately control how developed a world gets.


r/madeinpython • • Jan 14 '23

Deep-timeit: Time each individual line of a function in python!

22 Upvotes

Deep-timeit is a module that allows accurate and granular timing of a function in python, and produces a colour-coded heat-map of the results! This can be very useful when your code runs too slowly, and you want to find the bottlenecks!

https://github.com/Yetiowner/Deep-time-it


r/madeinpython • • Dec 21 '22

Mini-Map I built for cities 99.8% Python

Thumbnail
youtu.be
22 Upvotes

r/madeinpython • • Oct 10 '22

I made a simple script that helps you stay focused while working

22 Upvotes

Essentially, the script closes a social media website that you might be distracted by whenever you open it. The script uses pyautogui to scan for the logo of the social media site because all social media sites have their logo at the top somewhere. When it detects that a logo is on the screen it uses the hotkey "ctrl" and "w" to close the tab. This is all done with pyautogui. Here's the script:

import time
import pyautogui
import requests

image_url = {"https://i.imgur.com/pl9mJJT.png": "youtube_dark.png",
             "https://i.imgur.com/qv25l8p.png": "tiktok_light.png",
             "https://i.imgur.com/uagowcj.png": "reddit_dark.png",
             "https://i.imgur.com/TgW9j05.png": "twitter_dark.png",
             "https://i.imgur.com/sbjWhlD.png": "youtube_light.png"}
# to add more sites here just put a link to the image, then choose a name for the file and add the
# file type at the end, examples are above of sites I already added
for key, value in image_url.items():
    img_data = requests.get(key).content
    with open(value, 'wb') as handler:
        handler.write(img_data)

while True:

    for key, value in image_url.items():
        screenShot = pyautogui.locateCenterOnScreen(value, confidence=0.8)
        print(screenShot)
        if screenShot is not None:
            pyautogui.hotkey("ctrl", "w")
            break
    time.sleep(5)

I also made a youtube tutorial here (the script is much simpler in the video though): https://www.youtube.com/watch?v=y-TQZdd5898

here's the GitHub: https://github.com/MOOOKS/distractionStopper1000/tree/main


r/madeinpython • • Aug 16 '22

Python Google Sheets and Excel Automation with XLWings and automated email sending.

22 Upvotes

How many times did you hear an accountant say,

"Man, I have the same repetitive job done over and over on Excel" or

"I spend 30 mins a day doing the same excel tasks over and over"

That's the beauty of XLWings. Now, I will show you how an 11-minute task that is done daily is transformed into a 30-second script that fires automatically with #CRON Jobs on #linux, mac, or windows!

This 500-line script will download automatically the workbook from Google Spreadsheet using the GSpread library, automate 3-page steps tasks in Excel and finally send an automated email to a person using the SMTP library! Everything is automated! See! With the power of automation, you no longer need to repeat tasks!

Check it out here! https://youtu.be/ed4OsePomFw


r/madeinpython • • Aug 10 '22

debuglater: dump Python traceback for later debugging

22 Upvotes

Hi r/madeinpython!

We just released debuglater, an open-source library that serializes a Python traceback object for later debugging.

Countless times, we've scheduled overnight jobs to find out the following day that they failed. While logs are helpful, they are often insufficient for debugging. debuglater allows you to store the traceback object so you can start a debugging session at any moment.

We built this to support our open-source framework for data scientists, who often execute long-running code in remote environments. However, we realized this could be useful for the Python community, so we created a separate package. This project is a fork of Eli Finer's pydump, so kudos to him for laying the foundations! We made a few improvements like compatibility with recent Python versions and integration with IPython/Jupyter.

The implementation is quite interesting. You can see it here. The serialization step has two parts: it takes the traceback object and wraps it into a new object so it can be serialized; secondly, it stores the source code so you can debug even if you don't have access to the source code!

Please take it for a spin and let us know your feedback. Feel free to open an issue on GitHub if you find any quirks!


r/madeinpython • • Aug 04 '22

I'm a grown man with grown kids, yet I still watch Minecraft videos and play it. In the videos that I watch, they always talk about using a program to automate tasks. I don't like "bots" in MMORPGs, but they can be useful in single player games. Here's an intro to pyautogui in games. Enjoy!

Thumbnail
youtu.be
22 Upvotes

r/madeinpython • • Jun 17 '22

Combined PyAudio, Wave, Numpy and Matplotlib modules to create a neat little audio recorder that then graphs the recording!

22 Upvotes

Explained the whole project here:

https://www.youtube.com/watch?v=3oA_griyboI

And if you just want the code I threw it in a github repo!

https://github.com/plemaster01/RecordAndGraph


r/madeinpython • • Jun 08 '22

Made a full playable Piano In Python Using the PyGame Framework!

22 Upvotes

So I used the PyGame module to create a piano GUI, processing 88 individual wav files for each key of the piano, and then made a full playable piano in python. I made it so you can play it with the keyboard or the mouse and I made a YouTube vid showcasing the whole project here: https://www.youtube.com/watch?v=47c_1wOa2so

And the project can be found at the GitHub Link Here: https://github.com/plemaster01/PythonPiano

Hope you like it :)


r/madeinpython • • May 20 '22

Python Wrapper for newly announced WhatsApp Cloud API

22 Upvotes

WhatsApp just opened up its Cloud API to smoothen integration with WhatsApp messaging but it is not always easy for a developer to get started

So I just made Heyoo, An Opensource python wrapper to make the integration even smoother.

Have a look https://github.com/Neurotech-HQ/heyoo


r/madeinpython • • May 13 '22

Made a Full Drum Kit/Beat Maker Project in Python with the PyGame Module! GitHub Link in the comments :)

Thumbnail
youtube.com
22 Upvotes

r/madeinpython • • Feb 07 '22

The first ever thing i managed to turn into an exe, a memey game launcher for my personal game cd

Thumbnail
gallery
22 Upvotes

r/madeinpython • • Jan 25 '22

Python development environment entirely in docker. Includes VS-code IDE, job scheduler, and other tools for linting, testing, auto-documentation, and profiling.

22 Upvotes

https://github.com/bluxmit/alnoda-workspaces/tree/main/workspaces/python-workspace

I made this when working on multiple projects. It helped me a lot to isolate the complete environments in the docker containers and easily switch between projects. Also, we made a common dev environment for the team.


r/madeinpython • • Jan 01 '22

I made an advanced system monitor for GNU/Linux distributions in Python 3.10 and Qt 5.15.0 for fun - Hope you like it!

22 Upvotes

You can find the project here https://pypi.org/project/obserware/ and the repository here https://gitlab.com/t0xic0der/obserware. If you have Python 3.10 and are running any GNU/Linux distribution - please try it out by installing it.

pip3 install obserware

Here are some screenshots.

Feedbacks are very appreciated and if you end up liking the project, please feel free to star the repository.


r/madeinpython • • Jul 09 '21

15 ways to create small and useful python one-liner | Explained with animations

Thumbnail
youtu.be
22 Upvotes

r/madeinpython • • Jun 26 '21

Python program that generates random nicknames for users who post or comment in /r/getnicknamed

22 Upvotes

Subreddit: r/getnicknamed

You can get your official nickname at /r/getnicknamed - it's a silly little project but I hope a few of you post/comment there to test it out.

My script uses 2 json files (one has a list of name prefixes, the other has a list of adjectives) to generate a random nickname.

Usernames are pulled from the subreddit's comments and submissions in a timed while loop. Usernames are then checked against the existing list of usernames to ensure no duplicates. Once the script verifies a new username, it generates a nickname for that user. Usernames and nicknames are stored in a dict, with username as the key and nickname as the value. This dict is also used to ensure no two users have the same nickname.

See the project's GitHub here.


r/madeinpython • • Nov 10 '20

Job Collector (Indeed)

22 Upvotes

Hey guys!

I know you've probably seen hundreds of job scrapers that collect data from Indeed, but I wanted to show you my version of a job scraper!

I've been out of work for the last 6 months, so I thought, what better way to keep my Python skills sharp and look for a job at the same time than to build a job scraper.

Using scrapy, I made a simple and easy to use scraper that is also flexible enough to add on usability as needed. Installing and using the program should be pretty straight forward...

  1. Clone the repository onto your local machine.

  2. Install the required python modules. pip install -r requirements.txt

  3. Run through the config.yaml file and make any necessary changes to the settings.

  4. Run the main.py file and wait for the program to finish running.

  5. You should now see a folder labeled "output." You will find the completed files in that folder.

As one of my first "real" projects, I thought I would share it with the awesome community here on Reddit. Hopefully, it helps someone with their job search as well!

https://github.com/tarkoon/job_collector


r/madeinpython • • Oct 04 '20

Youtube Song Downloader in 100% Python . This is my 4th project in python and I have been learning this for 1 week only , so please go easy on me.

22 Upvotes

https://github.com/fast-and-curious-1910/Youtube-Song-Downloader

Youtube Song Downloader

Youtube Song Downloader in Python

About

This is a song downloader Made In #Python . Have you ever wanted to download an MP3 File (For any zumba / yoga classes or even studying) , but you are busy in some other work as well and you want to focus on the work you are doing right now? Guess what , I have you covered!

Usage

Important Note : Chromewebdriver Must Be On PATH other wise it will not work.

First open songs.txt and write the name of your song (Only One Song Is Accepted at a time) , save the file and close it. Run classes.py then main.py. Then the magic should happen a few things will happen:

  1. A new tab will open

  2. It will go to youtube.com

  3. It will got to YTMP3.cc and download the file

and that is it!

Could You Check Out My Channel On Youtube?


r/madeinpython • • Sep 26 '20

Want to know how hackers crack the password? Learn Ethical Hacking using Python.

Thumbnail
youtu.be
22 Upvotes

r/madeinpython • • Sep 16 '20

Network Scanner

22 Upvotes

Hello Guys,

Tonight I have just finished my network scanner tool. The program took about 3 days to implement, alongside of school. I'm thinking on adding more features in the future.

Repo: https://github.com/IVBecy/network_scanner


r/madeinpython • • Jul 28 '20

I made snowfall animation using only python

Thumbnail
youtube.com
22 Upvotes

r/madeinpython • • Jun 22 '20

Cash Register in Python and PyQt5 with barcode logon and 32 programmable buttons

Thumbnail
github.com
22 Upvotes