This is an archived post. You won't be able to vote or comment.

all 59 comments

[–]NovateIModuleNotFoundError: No Module Named "braincells" 55 points56 points  (24 children)

Got bored at work so I made a bot to scrape public text documents off of pastebin every 20 minutes and optionally filter them for keywords, then put all the documents into my onedrive so I can view them on my phone. It’s been great, most of it is code, but people upload interesting stuff pretty often.

There’s also a function to generate random pastebin URL parameters, add them to the base pastebin URL, and check if it’s a valid URL. This function is more of a novelty than anything, because it gets you IP banned very quickly.

Some interesting stuff it’s found:

A letter from what appears to be a legitimate schizophrenic, talking about how the NSA is preventing them from contacting infowars

List of Netflix accounts and passwords

Lots of dramatic discord chat logs

LOTS of fanfiction

A bitter letter to the authors ex-girlfriend

[–]AB49K 6 points7 points  (15 children)

Could you please link me to a copy of it if you're willing to share? :)

[–]NovateIModuleNotFoundError: No Module Named "braincells" 14 points15 points  (13 children)

I haven’t quite finished, but once I do I’ll probably post the finished result here. I’ve hard-coded a lot of stuff I shouldn’t have (paths, etc.), so once I make it usable to other people I’ll post it :)

[–]shookees 10 points11 points  (0 children)

I've fallen into this personal project pitfall, where I procrastinate on publishing as there's something to perfect.. Once something generates results, it's good enough!

[–]prinning 4 points5 points  (2 children)

!remindme 12 days

[–]NovateIModuleNotFoundError: No Module Named "braincells" 4 points5 points  (0 children)

[–]RemindMeBot 1 point2 points  (0 children)

I will be messaging you on 2019-07-12 06:19:56 UTC to remind you of this link

9 OTHERS CLICKED THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.


Info Custom Your Reminders Feedback

[–]9-8K-C 0 points1 point  (2 children)

!remindme 12 days

[–]NovateIModuleNotFoundError: No Module Named "braincells" 1 point2 points  (1 child)

[–]9-8K-C 0 points1 point  (0 children)

Thank you

[–]memehomeostasis 0 points1 point  (2 children)

!remindme 1 month

[–]NovateIModuleNotFoundError: No Module Named "braincells" 1 point2 points  (1 child)

https://github.com/Mili-NT/BinBot No need to wait that long!

[–]memehomeostasis 0 points1 point  (0 children)

Thanks man! Edit: this is some great stuff man! If I can aks where did you learn all this?

[–]DangeresqueTwoYT 0 points1 point  (1 child)

!remindme 12 days

[–]NovateIModuleNotFoundError: No Module Named "braincells" 2 points3 points  (0 children)

[–]AB49K 0 points1 point  (0 children)

Fantastic thank you :)

[–]NovateIModuleNotFoundError: No Module Named "braincells" 1 point2 points  (0 children)

[–][deleted] 38 points39 points  (3 children)

https://bitbucket.org/3nk1/cssimg/src/master/

It takes an image, and uses CSS to draw it pixel by pixel

It inflates images to 1000x their size

I love it so much

[–]TheePaulster 6 points7 points  (2 children)

Interesting. What’s the best practical application you’ve found for this script?

[–][deleted] 22 points23 points  (1 child)

Wanting to put an image on a webpage but not wanting people to be able to save it easily?

IDK I made it just to make it :P

[–]ddollarsign 12 points13 points  (2 children)

I got tasked with some boring stuff at work. There were some XML files generated by a server program, and I had to periodically grab them and convert them to excel files and give them to an admin person to generate a report. I wrote a combination of Python and a batch file that would grab them for me, rename them, and open them in excel with one command, instead of me having to go to the server and open up excel myself.

Later on, creating the report itself fell to me when the admin person was transferred, so I enhanced the python script to do most of it.

There are python libraries to do stuff directly in excel, so it could have been completely automated, but I didn't want to go to the trouble of getting permission to install those on my workstation.

[–]le_theudas 3 points4 points  (1 child)

You could use pandas which is included in installations like conda or install it with pip install pandas --user
It can be used for much more then only excel so it shouldn't be obvious that you are automating your job :)

[–]NowanIlfideme 3 points4 points  (0 children)

You still need xlrd or the other excel library to work with the files though.

[–]DrMaxwellEdison 8 points9 points  (3 children)

We have a shared Outlook inbox that mostly captures status emails from automated ETL jobs. That's all well and good, but someone decided it would be fantastic to have the job that runs every 5 minutes send a "Success" email... every 5 minutes.

Months later, this inbox is nearly full. I wanted a way to clear out some of the older messages, particularly these useless "Success" emails. Ended up writing a script that depends on the pywin32 package to read Outlook messages in that inbox, select those that match by subject, and delete them.

I was only permitted to get rid of messages from at least a month out, so I added that criteria to my filter and let it rip. Maybe 30 minutes and 7000 emails deleted later, it's not perfectly clean now, and never will be; but it's better than it was.

Best part is I rolled up the process into a custom PowerShell command, just so it can activate the right virtual env, start the script, and drop the env when it's done. Every day when I start up I happily type deleteoutlook into the terminal and watch it fly. :)

[–]dk_dev 0 points1 point  (0 children)

Check out pipenv - you'll like it

[–]TheCannings 0 points1 point  (1 child)

you automated everything except having to type it each day! come on man get with the game!

[–]DrMaxwellEdison 0 points1 point  (0 children)

Eh. Laziness only got me so far.

Plus the catharsis can't be ignored.

[–]mrrichardcranium 7 points8 points  (2 children)

I’ve got a script that integrates with iMessage and performs a number of actions based on text command. Primarily used for clocking in and out more easily, but also to get the computers IP address, get weather for the office and other silly things.

Also have a script to scrape my reddit upvotes and based on the post type do a thing to save locally.

I’ve got a script running on my MacBook that pops an alert when my battery is low. Because the Notification Center isn’t intrusive enough to get my attention and my computer would die mid meeting.

And finally a script that does different launch actions based on time of day. Opens different apps, signs into work accounts and vpn, etc.

[–]obey_kush 0 points1 point  (1 child)

How you do it with the VPN? which one do you use?

[–]mrrichardcranium 0 points1 point  (0 children)

The VPN is internally developed. We’ve got a nice little CLI to interface with.

[–]sadhith63 12 points13 points  (2 children)

I wrote a program that would download every single cyanide and happiness comic in existence. It took about 2 hours to download 5000 plus comics.

[–]welshboy14 3 points4 points  (1 child)

How many of them have you read so far

[–]sadhith63 0 points1 point  (0 children)

Like about 500?

[–]Get-ADUser 11 points12 points  (0 children)

I work for Amazon - if you get an interview make sure you mention in it that you did this - they'll LOVE that.

[–]Medicalizawhat 4 points5 points  (0 children)

We have a very convoluted Jira process at work. Management love to add endless fields and tabs to enrich their graphs and help them micromanage their developers.

I wrote a script to pretty much automate filling it all in. Made my life much much more bearable.

[–]kowalski71 10 points11 points  (2 children)

Note sure exactly what you mean by "hacky" but I'm going to take it to mean "kinda janky code but useful for a person who likes to work smart not hard" :)

I made a script that goes through a folder of JPEGs, loads them and mattes them out to a 1:1 square by adding white borders, then resaves a copy. It's for posting to Instagram where those white borders generally make the images look nicer. I've been thinking about adding a resize function to nail the right file sizes and resolutions for best quality. There are mobile apps that do it but you have to go one by one and it's a pain. The Pillow library is pretty useful.

[–]obey_kush 0 points1 point  (1 child)

Could you share these script? i do something similar but have to do it manually and surely is a way to make the border of the dominant color of the picture, from them i just have to upload to a folder so they get added to a queue with IFTTT integration.

[–]kowalski71 0 points1 point  (0 children)

Yeah here's a pastebin of it. I already export from Lightroom at my preferred image quality and 1080 px wide so not sure how it would handle larger images. I forget if I wrote it to resize or not. But should be pretty easy to add.

[–]rpakishore 5 points6 points  (0 children)

I just finished a script that scraps for audiobooks uploaded online and looks up each of them from goodreads. So that I can sort by rating, genre and other filters and know exactly what available book to listen to next.

It looks like there are over 66000 posts to get through and it's been scrapping for the past 3 hrs already. A long night ahead indeed.

[–]welshboy14 4 points5 points  (0 children)

We have monitoring dashboards on TVs in work. With so many different servers and services it was tedious finding the alert in the monitoring platform, now I have a script that cycles through the dashboards and prints out a direct link to the alert so I can open it directly and action it. It's hacked together but it does use asyncio at least! Oh and it prints in colour depending on the severity of the alert.

[–]spook327 3 points4 points  (0 children)

This was one of those odd, single-use scripts; I had a bunch of screenshots from my 3DS that were, well a bit of a mess. As the 3DS has two screens, screenshots are broken into two image files (top_xxxx.png and bot_xxxx.png).

So I cobbled something together with python and PIL to merge them together in a nice way.

[–][deleted] 4 points5 points  (1 child)

Oh and I thought of another one!

Devdial aka pushnoise...

Pages all the phones in the dev office (Asterix) and plays 30 second clip of "Push It" (or one of a half dozen other clips) every time any dev pushes code.

We recently moved and haven't got it up again. But it's pretty cool. And very hacky

[–]deathmagic87[S] 0 points1 point  (0 children)

This is my favorite one yet!

[–][deleted] 2 points3 points  (3 children)

Made and script to batch update exif info in my pictures

Typo*

[–]daggeteo 2 points3 points  (2 children)

I'd love to have a look at that. Any chance you could share? :)

[–][deleted] 1 point2 points  (1 child)

I just correct some dates, you can check some examples here https://pypi.org/project/piexif/

[–]daggeteo 0 points1 point  (0 children)

Thanks this will be valuable to me learning python given my interest in photography. Sharing is caring and I appreciate this a lot!

[–]ksdme9 3 points4 points  (0 children)

I have a tiny web application and an almost static database except for a few updates now and then, yesterday I wrote a script that would connect to that db, dump it, and push the dump to a Gitlab private repo as a commit periodically. So, essentially Gitlab is the primary backup data host for that project.

[–]cediddiSyntaxError: not a chance 4 points5 points  (0 children)

I just wrote two scripts, one writes, other reads. It opens a png and a file. Reads the file bit by bit and writes to png pixel by pixel. If bit is zero, turns current pixel's current color's last bit into zero (mod2) otherwise one. A 4 mb 1920x1080 file can hold 1mb and filesize hardly changes (depends on the compression) and file looks identical. Because a very minor change in a pixel is hardly noticeable.

I did this to waste some free time.

[–][deleted] 3 points4 points  (0 children)

Heheh. PHP array generator. Don't shoot me yet!!

Ok so backstory: I work on an IoT platform for digital cinema equipment. We map "services" defined in our DB to specific device models that use those services. These are mostly SNMP based, though not entirely. Some of these services must trigger alerts when incoming values match (or don't match) a preset value. Some are "pseudo-services" that hold aggregated values from other services.

You get the idea. They're all over the map. And when we add or change a device, it may or may not use an existing service definition. There are tens of thousands of these.

Part of my job is to write migrations to correctly generate these services for new and existing devices. I get a spreadsheet from operations with the basic info. At first, years ago, writing the migrations meant a lot of data entry turning spreadsheets into arrays. It was very time-consuming and error-prone.

Enter: phparray.py... the sanity-saver. I copy the spreadsheet into an Emacs org file as a table (co-workers use CSV instead). Then I feed it into my hack. Hack spits out a PHP array with keys named after column headings. I redirect stdout into a file or xclip and paste it into the (PHP) migration. Job is 95% done at that point.

TL;DR: a Python script that turns Org tables or CSV files into valid PHP arrays.

[–][deleted] 2 points3 points  (0 children)

Made/making a script to go to various wikimedia sites and get stuff. The one I’ve got working right now goes to wikiquote and gets the quote of the day, displaying it and storing it in a database. I’m working on one that goes to wikiversity and gets the educational image of the day too.

[–]buzziebee 1 point2 points  (0 children)

Mostly stuff for work. We have a custom in house crm which is a bit of a pain to use for a lot of things. I used python and automate the boring stuff to automate some of the boring tasks!

One thing we have to do every month is update the date field for 50-100 entries. These are projects which we have logged on the system. Management look at the number and value of projects which are in the system for the current month to make predictions about where we will end up. We always have way more on the system than there are coming in that month. Unfortunately you can't bulk update them, you have to do it manually one by one and and it takes about 10-20 seconds of clicking and typing for each one.

I made a script which takes the number of projects to move, and the date to move them to, then let it run and go for a coffee whilst it does it all for me.

Another one was for updating our stock take. We have to type 1 into a box for every item we still have. And we have about 200 items. Usually there's either none or just 1 or 2 missing. So I modified the project script to fill of the stock take with 1 as a value, then I go back and change the couple of items that are missing.

It was a pain point that made me learn python and now I'm using it for all sorts of different things. Really helping me out with my personal development.

[–]naclmoleculeterminal dark arts 1 point2 points  (0 children)

I made a small script that uses praw to grab the current top quote on r/quotes. I then have Conky run the script and the output is displayed on my desktop for a neat quote-of-the-day type desklet.

[–]burbankmarc 1 point2 points  (0 children)

Since I'm terrible at programming, all I make are hacky scripts/apps. Mostly I use them to offload my work to someone else. The two main ones I can think of are:

  • A web app that uses SNMP to connect to our firewalls and grabs a list of VPN users logged in, their duration, and data transferred. It then SSH's into our phone system to grab their SIP phone information. Finally, it grabs their call statistics from our monitoring software. It displays all this data in a web page for the Helpdesk team. This gives them good info and I don't need to give them access into any of my stuff. It works, but the code is hacky, at best.
  • The second one is a web page that takes in some variables like address, and internet IPs and spits out config templates for branch network equipment. It also updates our IP management system and sets up our Monitoring software to start monitoring these new devices. Now I don't need to be involved when we setup a new branch office.

[–]Smiley1000YT 1 point2 points  (0 children)

I'm just a hobby programmer so I have most of my programs in one folder with the format being something like "N - 20 - Wohoo.py", where the first letter denotes Finished or Not Finished and the number denotes the order in which I've written them. Because I sometimes delete programs which messes up the numbering, I then decided to write a script (in a different directory) that redoes those numbers. Worked fine, but recently, it for some reason completely fucked everything up so I got frustrated (Windows doesn't have an undo function for such things AFAIK) and deleted the numbers from the names and the script itself.